schema([ Forms\Components\TextInput::make('name') ->required() ->maxLength(255), Forms\Components\TextInput::make('email') ->email() ->required() ->maxLength(255), Forms\Components\DateTimePicker::make('email_verified_at'), Forms\Components\TextInput::make('password') ->password() ->dehydrateStateUsing(fn ($state) => filled($state) ? bcrypt($state) : null) ->required(fn (string $context): bool => $context === 'create') ->maxLength(255), Forms\Components\Select::make('roles') ->relationship('roles', 'name') ->multiple() ->preload(), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name') ->searchable(), Tables\Columns\TextColumn::make('email') ->searchable(), Tables\Columns\TextColumn::make('roles.name') ->badge(), Tables\Columns\TextColumn::make('email_verified_at') ->dateTime() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => ListUsers::route('/'), 'create' => CreateUser::route('/create'), 'edit' => EditUser::route('/{record}/edit'), ]; } }