diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php new file mode 100644 index 0000000..eac380b --- /dev/null +++ b/app/Filament/Resources/UserResource.php @@ -0,0 +1,79 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required(), + Forms\Components\TextInput::make('email') + ->email() + ->required(), + Forms\Components\TextInput::make('password') + ->password() + ->required(), + ]); + } + + 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('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('updated_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 [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListUsers::route('/'), + 'create' => Pages\CreateUser::route('/create'), + 'edit' => Pages\EditUser::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Resources/UserResource/Pages/CreateUser.php b/app/Filament/Resources/UserResource/Pages/CreateUser.php new file mode 100644 index 0000000..73aa46d --- /dev/null +++ b/app/Filament/Resources/UserResource/Pages/CreateUser.php @@ -0,0 +1,12 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required(), + Forms\Components\TextInput::make('email') + ->email() + ->required(), + Forms\Components\TextInput::make('password') + ->password(), + ]); + } +} diff --git a/app/Filament/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Resources/UserResource/Pages/ListUsers.php new file mode 100644 index 0000000..0766ffe --- /dev/null +++ b/app/Filament/Resources/UserResource/Pages/ListUsers.php @@ -0,0 +1,19 @@ +