File: D:/HostingSpaces/SBogers10/honger.komma.pro/app/KommaApp/Services/ServicesComposer.php
<?php
/**
* Created by PhpStorm.
* User: mike
* Date: 19/05/17
* Time: 08:36
*/
namespace App\KommaApp\Services;
use App\KommaApp\Services\Models\Service;
use Illuminate\Contracts\View\View;
class ServicesComposer
{
public static $service;
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
if(empty($this::$service)) {
$this::$service = Service::with('translation')
->has('translation')
->where('active', 1)
->where('show_in_menu', 1)
->orderBy('lft')
->get();
}
// Return all services to view
$view->with(['services' => $this::$service]);
}
}