<?php

namespace App\View\Composers;

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

class LanguageComposer
{
    public function compose(View $view){
        $languages = Cache::remember('languages', 60, function() {
            return Language::where('status', 1)->orderByDesc('default')->get();
        });

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