<?php

namespace App\View\Composers;

use Illuminate\View\View;
use App\Models\Admin\Page;
use Illuminate\Support\Facades\Cache;

class NavigationComposer
{
    public function compose(View $view){
        $headerMenu = Cache::remember('headerMenu', 60, function () {
            return Page::where('display_in_navigation', 1)->orderBy('ordernum')->get();
        });

        $view->with([
            'headerMenu' => $headerMenu,
        ]);
    }
}