schema([ Section::make()->schema([ Forms\Components\Grid::make()->schema([ Forms\Components\TextInput::make('name') ->label('ФИО') ->required() ->maxLength(255) ->live(onBlur: true), Forms\Components\TextInput::make('email') ->label('Email') ->email() ->required() ->unique(ignoreRecord: true) ->maxLength(255), Forms\Components\DateTimePicker::make('email_verified_at')->label('Почта подтверждена'), Forms\Components\TextInput::make('password') ->label('Пароль') ->password() ->default(Str::password(15)) ->required(fn (string $context): bool => $context === 'create') ->dehydrated(fn ($state) => filled($state)) ->maxLength(255), Forms\Components\Select::make('roles') ->label('Роль') ->relationship('roles', 'name') ->multiple() ->preload() ->searchable(), Forms\Components\Select::make('permissions') ->label('Разрешения') ->relationship('permissions', 'name') ->multiple() ->preload() ->searchable() ]), ]), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name')->label('ФИО') ->searchable()->sortable(), Tables\Columns\TextColumn::make('email')->label('Email') ->searchable()->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ RelationManagers\UserDetailRelationManager::class ]; } public static function getPages(): array { return [ 'index' => Pages\ListUsers::route('/'), 'create' => Pages\CreateUser::route('/create'), 'edit' => Pages\EditUser::route('/{record}/edit'), ]; } public static function getPermissionPrefixes(): array { return [ 'view', 'view_any', 'create', 'update', 'delete', 'delete_any', 'invite' ]; } }