components([ Hidden::make('email_verified_at')->default(now()), Section::make('User Details') ->columnSpanFull() ->columns(2) ->schema([ TextInput::make('name') ->columns(1) ->required(), TextInput::make('email') ->label('Email address') ->email() ->required(), TextInput::make('password') ->password() ->revealable() ->dehydrated(fn ($state): bool => filled($state)) ->dehydrateStateUsing(fn ($state): string => Hash::make($state)) ->same('password_confirmation') ->rule(Password::min(8) ->mixedCase() ->numbers() ->symbols() ->uncompromised()) ->label('Password'), TextInput::make('password_confirmation') ->password() ->dehydrated(false) ->same('password') ->revealable(), ]), Section::make('Bookmaker Configuration') ->columnSpanFull() ->columns(2) ->schema([ Select::make('client_id') ->relationship('client', 'name') ->preload(), Select::make('bookmaker_id') ->label('Active Bookmaker') ->options(fn () => Bookmaker::query()->where('is_client', 1)->pluck('name', 'id')) ->preload(), Select::make('partner_bookmaker_id') ->label('Partner Bookmaker') ->options(function () { $bookmaker = Client::where('id', auth()->user()->client_id)->value('bookmaker'); return Bookmaker::query()->whereIn('id', $bookmaker)->pluck('name', 'id'); }) ->preload(), Select::make('provider_id') ->relationship('provider', 'name') ->preload(), ]), Section::make('Authorisations') ->visible(fn () => auth()->user()->hasRole('super_admin')) ->columnSpanFull() ->schema([ Select::make('roles') ->label('Rollen') ->prefixIcon('phosphor-gear') ->aboveContent('Only visible for super_admin') ->visible(fn () => auth()->user()->hasRole('super_admin')) ->relationship('roles', 'name') ->multiple() ->preload() ->searchable(), ]), ]); } }