first
This commit is contained in:
53
app/Providers/AppServiceProvider.php
Normal file
53
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Filament\CMS\Home\HomeSettings;
|
||||
use App\Models\Brand;
|
||||
use App\Settings\SiteSettings;
|
||||
use App\Settings\SiteSocialSettings;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\View as ViewFacade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
$this->addSettingsToViews();
|
||||
|
||||
// logDB();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings to views
|
||||
*/
|
||||
public function addSettingsToViews(): void
|
||||
{
|
||||
ViewFacade::composer(['web.layouts.app'], function (View $view) {
|
||||
$view->with('settings', app(SiteSettings::class));
|
||||
$view->with('socialMedia', app(SiteSocialSettings::class));
|
||||
});
|
||||
|
||||
ViewFacade::composer('web.pages.home.index', function (View $view) {
|
||||
$brands = Brand::query()->get(['id', 'image']);
|
||||
|
||||
$view->with('homepage', app(HomeSettings::class));
|
||||
$view->with('brands', $brands);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user