Domain: amberpublishers.in
Server Adress: 86.38.243.169
privdayz.com
<?php
namespace App\Providers;
use App\Models\Category;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\ServiceProvider;
class MenuComposerServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*/
public function boot(): void
{
view()->composer('*', function ($view) {
$headerCategories = Cache::remember('headerCategories', 60, function () {
return Category::select('name', 'categoryslug')->get();
});
$footerCategories = Cache::remember('footerCategories', 15, function () {
return Category::withCount('news')
->orderBy('news_count', 'desc')
->take(5)
->get();
});
$view->with('headerCategories', $headerCategories);
$view->with('footerCategories', $footerCategories);
});
}
}