-
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: sample location resource is now available but not in navigation
- Loading branch information
1 parent
af543ec
commit 104ad85
Showing
5 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
app/Filament/Dashboard/Resources/SampleLocationResource.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,108 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources; | ||
|
||
use App\Filament\Dashboard\Resources\SampleLocationResource\Pages; | ||
use App\Filament\Dashboard\Resources\SampleLocationResource\RelationManagers\MoleculesRelationManager; | ||
use App\Filament\Dashboard\Resources\SampleLocationResource\RelationManagers; | ||
use App\Models\SampleLocation; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
use Tapp\FilamentAuditing\RelationManagers\AuditsRelationManager; | ||
|
||
class SampleLocationResource extends Resource | ||
{ | ||
protected static ?string $model = SampleLocation::class; | ||
|
||
protected static bool $shouldRegisterNavigation = false; | ||
protected static ?string $navigationGroup = 'Data'; | ||
protected static ?int $navigationSort = 6; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-s-viewfinder-circle'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('iri') | ||
->maxLength(255), | ||
Forms\Components\Select::make('organism_id') | ||
->relationship('organisms', 'name') | ||
->searchable() | ||
->required(), | ||
Forms\Components\TextInput::make('collection_ids') | ||
->maxLength(255), | ||
Forms\Components\TextInput::make('molecule_count') | ||
->numeric(), | ||
// Forms\Components\TextInput::make('slug') | ||
// ->maxLength(255), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('iri') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('organism_id') | ||
->numeric() | ||
->sortable(), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('collection_ids') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('molecule_count') | ||
->numeric() | ||
->sortable(), | ||
Tables\Columns\TextColumn::make('slug') | ||
->searchable(), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
Tables\Actions\ViewAction::make(), | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
MoleculesRelationManager::class, | ||
AuditsRelationManager::class, | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListSampleLocations::route('/'), | ||
'create' => Pages\CreateSampleLocation::route('/create'), | ||
'view' => Pages\ViewSampleLocation::route('/{record}'), | ||
'edit' => Pages\EditSampleLocation::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Dashboard/Resources/SampleLocationResource/Pages/CreateSampleLocation.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,12 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources\SampleLocationResource\Pages; | ||
|
||
use App\Filament\Dashboard\Resources\SampleLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateSampleLocation extends CreateRecord | ||
{ | ||
protected static string $resource = SampleLocationResource::class; | ||
} |
20 changes: 20 additions & 0 deletions
20
app/Filament/Dashboard/Resources/SampleLocationResource/Pages/EditSampleLocation.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,20 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources\SampleLocationResource\Pages; | ||
|
||
use App\Filament\Dashboard\Resources\SampleLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditSampleLocation extends EditRecord | ||
{ | ||
protected static string $resource = SampleLocationResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\ViewAction::make(), | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Dashboard/Resources/SampleLocationResource/Pages/ListSampleLocations.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,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources\SampleLocationResource\Pages; | ||
|
||
use App\Filament\Dashboard\Resources\SampleLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListSampleLocations extends ListRecords | ||
{ | ||
protected static string $resource = SampleLocationResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Dashboard/Resources/SampleLocationResource/Pages/ViewSampleLocation.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,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Dashboard\Resources\SampleLocationResource\Pages; | ||
|
||
use App\Filament\Dashboard\Resources\SampleLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ViewRecord; | ||
|
||
class ViewSampleLocation extends ViewRecord | ||
{ | ||
protected static string $resource = SampleLocationResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\EditAction::make(), | ||
]; | ||
} | ||
} |