Update Submissions and add fields
This commit is contained in:
11
app/Filament/Resources/Systems/Pages/CreateSystem.php
Normal file
11
app/Filament/Resources/Systems/Pages/CreateSystem.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems\Pages;
|
||||
|
||||
use App\Filament\Resources\Systems\SystemResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSystem extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SystemResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Systems/Pages/EditSystem.php
Normal file
19
app/Filament/Resources/Systems/Pages/EditSystem.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems\Pages;
|
||||
|
||||
use App\Filament\Resources\Systems\SystemResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSystem extends EditRecord
|
||||
{
|
||||
protected static string $resource = SystemResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Systems/Pages/ListSystems.php
Normal file
19
app/Filament/Resources/Systems/Pages/ListSystems.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems\Pages;
|
||||
|
||||
use App\Filament\Resources\Systems\SystemResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSystems extends ListRecords
|
||||
{
|
||||
protected static string $resource = SystemResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Filament/Resources/Systems/Schemas/SystemForm.php
Normal file
20
app/Filament/Resources/Systems/Schemas/SystemForm.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SystemForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
48
app/Filament/Resources/Systems/SystemResource.php
Normal file
48
app/Filament/Resources/Systems/SystemResource.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems;
|
||||
|
||||
use App\Filament\Resources\Systems\Pages\CreateSystem;
|
||||
use App\Filament\Resources\Systems\Pages\EditSystem;
|
||||
use App\Filament\Resources\Systems\Pages\ListSystems;
|
||||
use App\Filament\Resources\Systems\Schemas\SystemForm;
|
||||
use App\Filament\Resources\Systems\Tables\SystemsTable;
|
||||
use App\Models\System;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SystemResource extends Resource
|
||||
{
|
||||
protected static ?string $model = System::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SystemForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SystemsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSystems::route('/'),
|
||||
'create' => CreateSystem::route('/create'),
|
||||
'edit' => EditSystem::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Filament/Resources/Systems/Tables/SystemsTable.php
Normal file
42
app/Filament/Resources/Systems/Tables/SystemsTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Systems\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SystemsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->searchable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user