40 lines
900 B
PHP
40 lines
900 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Lunar\Admin\Support\Facades\LunarPanel;
|
|
use Modules\Core\Auth\Filament\Pages\Login;
|
|
use Modules\Core\CorePlugin;
|
|
|
|
class PanelServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
if (! $this->isAdminRequest()) {
|
|
return;
|
|
}
|
|
|
|
LunarPanel::panel(function (\Filament\Panel $panel) {
|
|
return $panel
|
|
->login(Login::class)
|
|
->plugin(new CorePlugin());
|
|
});
|
|
|
|
LunarPanel::disableTwoFactorAuth();
|
|
LunarPanel::register();
|
|
}
|
|
|
|
private function isAdminRequest(): bool
|
|
{
|
|
if ($this->app->runningInConsole()) {
|
|
return true;
|
|
}
|
|
|
|
$path = request()->path();
|
|
|
|
return str_starts_with($path, 'boboko')
|
|
|| str_starts_with($path, 'livewire');
|
|
}
|
|
}
|