workshop_lara_nova/app/Providers/NovaServiceProvider.php
2025-03-22 10:19:15 +00:00

96 lines
2.1 KiB
PHP

<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Laravel\Fortify\Features;
use Laravel\Nova\Nova;
use Laravel\Nova\NovaApplicationServiceProvider;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
parent::boot();
//
}
/**
* Register the configurations for Laravel Fortify.
*/
protected function fortify(): void
{
Nova::fortify()
->features([
Features::updatePasswords(),
// Features::emailVerification(),
// Features::twoFactorAuthentication(['confirm' => true, 'confirmPassword' => true]),
])
->register();
}
/**
* Register the Nova routes.
*/
protected function routes(): void
{
Nova::routes()
->withAuthenticationRoutes(default: true)
->withPasswordResetRoutes()
->withoutEmailVerificationRoutes()
->register();
}
/**
* Register the Nova gate.
*
* This gate determines who can access Nova in non-local environments.
*/
protected function gate(): void
{
Gate::define('viewNova', function (User $user) {
return in_array($user->email, [
//
]);
});
}
/**
* Get the dashboards that should be listed in the Nova sidebar.
*
* @return array<int, \Laravel\Nova\Dashboard>
*/
protected function dashboards(): array
{
return [
new \App\Nova\Dashboards\Main,
new \App\Nova\Dashboards\WorkshopDashboard,
];
}
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array<int, \Laravel\Nova\Tool>
*/
public function tools(): array
{
return [];
}
/**
* Register any application services.
*/
public function register(): void
{
parent::register();
//
}
}