-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: shows the related organisms in the relations in edit mode
- Loading branch information
1 parent
e0ef6f7
commit 8ebfb66
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...Filament/Dashboard/Resources/ReportResource/RelationManagers/OrganismsRelationManager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources\ReportResource\RelationManagers; | ||
|
||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\RelationManagers\RelationManager; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
|
||
class OrganismsRelationManager extends RelationManager | ||
{ | ||
protected static string $relationship = 'organisms'; | ||
|
||
public function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
]); | ||
} | ||
|
||
public function table(Table $table): Table | ||
{ | ||
return $table | ||
->recordTitleAttribute('name') | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name'), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->headerActions([ | ||
Tables\Actions\AttachAction::make() | ||
->multiple(), | ||
]) | ||
->actions([ | ||
Tables\Actions\DetachAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DetachBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
} |