schema([ Section::make('Personal Information') ->schema([ TextInput::make('first_name') ->required() ->maxLength(255), TextInput::make('last_name') ->required() ->maxLength(255), TextInput::make('username') ->required() ->unique(ignoreRecord: true) ->maxLength(255), TextInput::make('email') ->email() ->required() ->unique(ignoreRecord: true), Textarea::make('address') ->required() ->rows(3), TextInput::make('phone') ->required() ->tel(), ]) ->columns(2), Section::make('Password') ->schema([ TextInput::make('password') ->password() ->required(fn (string $operation): bool => $operation === 'create') ->dehydrated(fn (?string $state): bool => filled($state)) ->same('password_confirmation'), TextInput::make('password_confirmation') ->password() ->required(fn (string $operation): bool => $operation === 'create') ->dehydrated(false), ]) ->columns(1) ->visible(fn (): bool => Auth::user()?->id === Request::route('record')), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('fullName') ->searchable(), TextColumn::make('email') ->searchable(), TextColumn::make('username') ->searchable(), TextColumn::make('phone'), TextColumn::make('tenant.name') ->label('Tenant'), TextColumn::make('email_verified_at') ->dateTime() ->sortable(), ]) ->filters([ // ]) ->actions([ ActionGroup::make([ ViewAction::make(), EditAction::make(), ]), ]) ->bulkActions([ BulkActionGroup::make([ DeleteBulkAction::make(), ]), ]) ->modifyQueryUsing(fn (Builder $query) => $query->where('tenant_id', Auth::user()->tenant_id)); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListUsers::route('/'), 'edit' => Pages\EditUser::route('/{record}/edit'), ]; } }