<?php namespace App\Libs\Composers;

use SustainabilityTopic;
use Solution;
use BusinessLine;
use Sector;

class SolutionsComposer
{

    public function compose($view)
    {
        /*
        $sustainabilityTopics = SustainabilityTopic::full()
            ->with('image', 'solutionsTestimonial')
            ->orderBy('website_objects.position', 'asc')
            ->get()->toArray();


        $businessLines = BusinessLine::full()
            ->where('status', 'published')
            ->orderBy('website_objects.position', 'asc')
            ->get();

        $solutions = Solution::full()
            ->with('sustainability_topics', 'sectors', 'overviewImage', 'values')
            ->orderBy('title', 'asc')->get();

        $corporateSectors = Sector::full()
            ->where('sector_type', 'corporate')
            ->orderBy('website_objects.position', 'asc')->get();
        $publicSectors = Sector::full()
            ->where('sector_type', 'public')
            ->orderBy('website_objects.position', 'asc')->get();

        $sectors = Sector::full()
            ->orderBy('website_objects.position', 'asc')->get();
         */

        $solutions = Solution::full()
            ->select("id", "title", "tagline", "lang_uri as uri", "lang_slug as slug",
                "website_objects.website_object_id", "overview_image_id", "fact_sheet_id",
                "icon_id", 'icon_hover_id')
            ->with(['overviewImage', 'icon', 'iconHover'])
            ->where('status', 'published')
            ->where('type', 'top_level')
            ->orderBy('position', 'asc')
            //->orderBy('title', 'asc')
            ->get();

        $view->with(array(
            'solutions' => $solutions
        ));
    }
}
