<?php namespace App\Libs\Composers;

use DefaultTemplateConfiguration;

class DefaultTemplateComposer
{
    use SidebarComposerTrait, RelatedComposerTrait;

    public function compose($view)
    {
        $data = $view->getData();
        $page = $data['object'];

        $templateData = DefaultTemplateConfiguration
            ::full()->where('entry_id', $page->id)->first();

        $view->with(array('templateData' => $templateData));

        $this->composeSidebar($view, \DefaultTemplateConfiguration::query());
        $this->composeRelated($view, $templateData);
    }
}
