*/ public array $bindings = [ UserAccountRepository::class => EloquentUserAccountRepository::class, UserAccountQueries::class => EloquentUserAccountQueries::class, PasswordLinkSender::class => LaravelPasswordLinkSender::class, ]; public function register(): void { $this->app->bind(Clock::class, fn () => new SystemClock(config('app.business_timezone'))); } public function boot(Router $router): void { $presentationPath = dirname(__DIR__, 2).'/Presentation'; Livewire::addNamespace('users', viewPath: $presentationPath.'/Livewire'); if (! $this->app->routesAreCached()) { $this->loadRoutesFrom($presentationPath.'/Routes/web.php'); } $router->pushMiddlewareToGroup('web', EnsureAccountIsUsable::class); // Ends the user's other sessions when their password changes. $router->pushMiddlewareToGroup('web', AuthenticateSession::class); // The language of the user interface; after the session has started. $router->pushMiddlewareToGroup('web', SetLocale::class); Event::listen(Login::class, StoreLocaleChosenBeforeLogin::class); if ($this->app->runningInConsole()) { $this->commands([CreateAdminCommand::class]); } Gate::define('users.manage', fn (User $user): bool => $user->role->canManageUsers()); // money.prices, money.expenses, money.quotes, money.billing: whether the // user may see that kind of money amounts (specification 2.3). foreach (MoneyPermission::cases() as $permission) { Gate::define('money.'.$permission->value, fn (User $user): bool => $user->canSeeMoney($permission)); } Password::defaults(fn () => Password::min(12)->mixedCase()->numbers()->symbols()); ResetPassword::toMailUsing(fn (CanResetPassword $notifiable, string $token): MailMessage => PasswordLinkMail::build( $notifiable, $token, __('users.password_mail.expires', ['count' => config('auth.passwords.users.expire')]), )); } }