feat: Dynamically load site logo and favicon from general settings.
This commit is contained in:
parent
24c95ceb87
commit
2d3d001ea4
@ -5,6 +5,7 @@
|
|||||||
use App\Filament\Pages\Auth\EmailVerification;
|
use App\Filament\Pages\Auth\EmailVerification;
|
||||||
use App\Filament\Pages\Auth\Login;
|
use App\Filament\Pages\Auth\Login;
|
||||||
use App\Filament\Pages\Auth\Registration;
|
use App\Filament\Pages\Auth\Registration;
|
||||||
|
use App\Settings\GeneralSettings;
|
||||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||||
use Filament\Http\Middleware\Authenticate;
|
use Filament\Http\Middleware\Authenticate;
|
||||||
use Filament\Http\Middleware\AuthenticateSession;
|
use Filament\Http\Middleware\AuthenticateSession;
|
||||||
@ -22,6 +23,7 @@
|
|||||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
use Swindon\FilamentHashids\Middleware\FilamentHashidsMiddleware;
|
use Swindon\FilamentHashids\Middleware\FilamentHashidsMiddleware;
|
||||||
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
||||||
@ -38,17 +40,21 @@ public function panel(Panel $panel): Panel
|
|||||||
mkdir($fullPath, 0777, true);
|
mkdir($fullPath, 0777, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = glob($fullPath.'/*');
|
$files = glob($fullPath . '/*');
|
||||||
if (! $files || count($files) === 0) {
|
if (! $files || count($files) === 0) {
|
||||||
$defaultImage = public_path('assets/img/bg/default.jpg');
|
$defaultImage = public_path('assets/img/bg/default.jpg');
|
||||||
$targetImage = $fullPath.'/default.png';
|
$targetImage = $fullPath . '/default.png';
|
||||||
copy($defaultImage, $targetImage);
|
copy($defaultImage, $targetImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$generalSettings = app(GeneralSettings::class);
|
||||||
|
|
||||||
return $panel
|
return $panel
|
||||||
->default()
|
->default()
|
||||||
->id('dashboard')
|
->id('dashboard')
|
||||||
->path('dashboard')
|
->path('dashboard')
|
||||||
|
->brandLogo(fn() => Storage::url($generalSettings->site_logo))
|
||||||
|
->favicon(fn() => Storage::url($generalSettings->site_icon))
|
||||||
->login(Login::class)
|
->login(Login::class)
|
||||||
->registration(Registration::class)
|
->registration(Registration::class)
|
||||||
->emailVerification(EmailVerification::class)
|
->emailVerification(EmailVerification::class)
|
||||||
@ -87,7 +93,7 @@ public function panel(Panel $panel): Panel
|
|||||||
FilamentBackgroundsPlugin::make()
|
FilamentBackgroundsPlugin::make()
|
||||||
->imageProvider(
|
->imageProvider(
|
||||||
MyImages::make()
|
MyImages::make()
|
||||||
->directory('storage/'.$directoryAuthBg)
|
->directory('storage/' . $directoryAuthBg)
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
->authMiddleware([
|
->authMiddleware([
|
||||||
@ -104,7 +110,6 @@ public function panel(Panel $panel): Panel
|
|||||||
'Pelindung',
|
'Pelindung',
|
||||||
])
|
])
|
||||||
->databaseNotifications()
|
->databaseNotifications()
|
||||||
->databaseNotificationsPolling('30s')
|
->databaseNotificationsPolling('30s');
|
||||||
->favicon(asset('assets/img/logo/favicon.png'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,22 +8,17 @@
|
|||||||
<meta name="author" content="Diskominfo Purwakarta">
|
<meta name="author" content="Diskominfo Purwakarta">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||||
<meta name="description" content="Sistem Media Komunikasi">
|
<meta name="description" content="Sistem Media Komunikasi">
|
||||||
<!-- favicon icon -->
|
|
||||||
<link rel="shortcut icon" href="images/favicon.png">
|
<link rel="shortcut icon" href="{{ asset('storage/' . $general->site_icon) }}">
|
||||||
<link rel="apple-touch-icon" href="images/apple-touch-icon-57x57.png">
|
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
|
|
||||||
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
|
|
||||||
<!-- google fonts preconnect -->
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<!-- style sheets and font icons -->
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/home/vendors.css') }}" />
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/home/vendors.css') }}" />
|
||||||
<link rel="stylesheet" href="{{ asset('css/home/style.css') }}" />
|
<link rel="stylesheet" href="{{ asset('css/home/style.css') }}" />
|
||||||
<link rel="stylesheet" href="{{ asset('css/home/responsive.css') }}" />
|
<link rel="stylesheet" href="{{ asset('css/home/responsive.css') }}" />
|
||||||
<link rel="stylesheet" href="{{ asset('css/home/it-business.css') }}" />
|
<link rel="stylesheet" href="{{ asset('css/home/it-business.css') }}" />
|
||||||
|
|
||||||
@vite(['resources/js/app.js'])
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-mobile-nav-style="full-screen-menu" data-mobile-nav-bg-color="#252840">
|
<body data-mobile-nav-style="full-screen-menu" data-mobile-nav-bg-color="#252840">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user