<?php namespace App\Libs\Composers;

use App\Models\FooterContent;

class LandingFooterComposer
{

    public function compose($view)
    {
        $content = FooterContent::full()->with([
            'socialLinks' => function($query) {
                $query->orderBy('position');
            }
        ])->first();

        $manageCookiesLabel = '';
        if (!empty($view->block->cta3)) {
            $manageCookiesLabel = json_decode($view->block->cta3)->label;
        }

        $view->with(array(
            'content' => $content,
            'manageCookiesLabel' => $manageCookiesLabel
        ));
    }
}
