121 lines
3.1 KiB
PHP
121 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\User;
|
|
use App\Nova\CategoryResource;
|
|
use App\Nova\Dashboards\Main;
|
|
use App\Nova\LogResource;
|
|
use App\Nova\QuestionResource;
|
|
use App\Nova\ScreeningResource;
|
|
use App\Nova\SessionResource;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Laravel\Fortify\Features;
|
|
use Laravel\Nova\Menu\MenuItem;
|
|
use Laravel\Nova\Menu\MenuSection;
|
|
use Laravel\Nova\Nova;
|
|
use Laravel\Nova\NovaApplicationServiceProvider;
|
|
|
|
class NovaServiceProvider extends NovaApplicationServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
parent::boot();
|
|
|
|
Nova::mainMenu(function (Request $request) {
|
|
return [
|
|
MenuSection::dashboard(Main::class)->icon('home'),
|
|
|
|
MenuSection::make('Questionnaire', [
|
|
MenuItem::resource(CategoryResource::class),
|
|
MenuItem::resource(QuestionResource::class),
|
|
MenuItem::resource(ScreeningResource::class),
|
|
MenuItem::resource(SessionResource::class),
|
|
])->icon('clipboard-document-list')->collapsible(),
|
|
|
|
MenuSection::make('Logs', [
|
|
MenuItem::resource(LogResource::class),
|
|
])->icon('chart-bar')->collapsible(),
|
|
|
|
MenuSection::make('Users', [
|
|
MenuItem::resource(\App\Nova\User::class),
|
|
])->icon('users')->collapsible(),
|
|
];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 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: false)
|
|
->withPasswordResetRoutes()
|
|
->withEmailVerificationRoutes()
|
|
->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 $user->role?->name === 'admin';
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 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,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 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();
|
|
|
|
//
|
|
}
|
|
}
|