diff --git a/app/Filament/Admin/Resources/TeamsResource.php b/app/Filament/Admin/Resources/TeamsResource.php new file mode 100644 index 0000000..3213801 --- /dev/null +++ b/app/Filament/Admin/Resources/TeamsResource.php @@ -0,0 +1,74 @@ +schema([ + TextInput::make('name')->autocapitalize('words')->required(), + Select::make('user_id')->label('Owner')->options( + \App\Models\User::all()->pluck('name', 'id') + )->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('id'), + TextColumn::make('name'), + TextColumn::make('owner.name'), + ]) + ->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\ListTeams::route('/'), + 'create' => Pages\CreateTeams::route('/create'), + 'edit' => Pages\EditTeams::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Admin/Resources/TeamsResource/Pages/CreateTeams.php b/app/Filament/Admin/Resources/TeamsResource/Pages/CreateTeams.php new file mode 100644 index 0000000..c926495 --- /dev/null +++ b/app/Filament/Admin/Resources/TeamsResource/Pages/CreateTeams.php @@ -0,0 +1,12 @@ + 'boolean', ]; } + + public function owner() + { + return $this->belongsTo(User::class, 'user_id'); + } }