<?php

namespace App\View\Composers;

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

class CountriesComposer
{
    public function compose(View $view){
        $countries = Cache::remember('countries', 60, function() {
            return Country::orderBy('name')->get();
        });

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