Skip to content

Commit

Permalink
feat: shows the related organisms in the relations in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramkanakam87 committed May 26, 2024
1 parent e0ef6f7 commit 8ebfb66
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Filament/Dashboard/Resources/ReportResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public static function getRelations(): array
RelationManagers\MoleculesRelationManager::class,
RelationManagers\CollectionsRelationManager::class,
RelationManagers\CitationsRelationManager::class,
RelationManagers\OrganismsRelationManager::class,
AuditsRelationManager::class,
];
}
Expand Down
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(),
]),
]);
}
}

0 comments on commit 8ebfb66

Please sign in to comment.