From 2d8f8c002171578444187e7caee4ed776228ccbd Mon Sep 17 00:00:00 2001 From: raza9798 Date: Thu, 22 Aug 2024 02:19:42 +0530 Subject: [PATCH] Teams integration --- .../Admin/Resources/TeamsResource.php | 74 +++++++++++++++++++ .../TeamsResource/Pages/CreateTeams.php | 12 +++ .../TeamsResource/Pages/EditTeams.php | 19 +++++ .../TeamsResource/Pages/ListTeams.php | 19 +++++ app/Models/Team.php | 5 ++ 5 files changed, 129 insertions(+) create mode 100644 app/Filament/Admin/Resources/TeamsResource.php create mode 100644 app/Filament/Admin/Resources/TeamsResource/Pages/CreateTeams.php create mode 100644 app/Filament/Admin/Resources/TeamsResource/Pages/EditTeams.php create mode 100644 app/Filament/Admin/Resources/TeamsResource/Pages/ListTeams.php 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'); + } }