Initial commit
This commit is contained in:
50
app/Filament/Resources/Authors/AuthorResource.php
Normal file
50
app/Filament/Resources/Authors/AuthorResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors;
|
||||
|
||||
use App\Filament\Resources\Authors\Pages\CreateAuthor;
|
||||
use App\Filament\Resources\Authors\Pages\EditAuthor;
|
||||
use App\Filament\Resources\Authors\Pages\ListAuthors;
|
||||
use App\Filament\Resources\Authors\Schemas\AuthorForm;
|
||||
use App\Filament\Resources\Authors\Tables\AuthorsTable;
|
||||
use App\Models\Author;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class AuthorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Author::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::UserGroup;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return AuthorForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return AuthorsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListAuthors::route('/'),
|
||||
'create' => CreateAuthor::route('/create'),
|
||||
'edit' => EditAuthor::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Authors/Pages/CreateAuthor.php
Normal file
11
app/Filament/Resources/Authors/Pages/CreateAuthor.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors\Pages;
|
||||
|
||||
use App\Filament\Resources\Authors\AuthorResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAuthor extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AuthorResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Authors/Pages/EditAuthor.php
Normal file
19
app/Filament/Resources/Authors/Pages/EditAuthor.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors\Pages;
|
||||
|
||||
use App\Filament\Resources\Authors\AuthorResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAuthor extends EditRecord
|
||||
{
|
||||
protected static string $resource = AuthorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Authors/Pages/ListAuthors.php
Normal file
19
app/Filament/Resources/Authors/Pages/ListAuthors.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors\Pages;
|
||||
|
||||
use App\Filament\Resources\Authors\AuthorResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAuthors extends ListRecords
|
||||
{
|
||||
protected static string $resource = AuthorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Filament/Resources/Authors/Schemas/AuthorForm.php
Normal file
30
app/Filament/Resources/Authors/Schemas/AuthorForm.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class AuthorForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
TextInput::make('website')
|
||||
->url()
|
||||
->maxLength(500)
|
||||
->default(null),
|
||||
TextInput::make('user_id')
|
||||
->numeric()
|
||||
->default(null),
|
||||
]);
|
||||
}
|
||||
}
|
||||
47
app/Filament/Resources/Authors/Tables/AuthorsTable.php
Normal file
47
app/Filament/Resources/Authors/Tables/AuthorsTable.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Authors\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class AuthorsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->searchable(),
|
||||
TextColumn::make('website')
|
||||
->searchable(),
|
||||
TextColumn::make('user_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Entries/EntryResource.php
Normal file
50
app/Filament/Resources/Entries/EntryResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries;
|
||||
|
||||
use App\Filament\Resources\Entries\Pages\CreateEntry;
|
||||
use App\Filament\Resources\Entries\Pages\EditEntry;
|
||||
use App\Filament\Resources\Entries\Pages\ListEntries;
|
||||
use App\Filament\Resources\Entries\Schemas\EntryForm;
|
||||
use App\Filament\Resources\Entries\Tables\EntriesTable;
|
||||
use App\Models\Entry;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class EntryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Entry::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'title';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return EntryForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return EntriesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListEntries::route('/'),
|
||||
'create' => CreateEntry::route('/create'),
|
||||
'edit' => EditEntry::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Entries/Pages/CreateEntry.php
Normal file
11
app/Filament/Resources/Entries/Pages/CreateEntry.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries\Pages;
|
||||
|
||||
use App\Filament\Resources\Entries\EntryResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEntry extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EntryResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Entries/Pages/EditEntry.php
Normal file
19
app/Filament/Resources/Entries/Pages/EditEntry.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries\Pages;
|
||||
|
||||
use App\Filament\Resources\Entries\EntryResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEntry extends EditRecord
|
||||
{
|
||||
protected static string $resource = EntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Entries/Pages/ListEntries.php
Normal file
19
app/Filament/Resources/Entries/Pages/ListEntries.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries\Pages;
|
||||
|
||||
use App\Filament\Resources\Entries\EntryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListEntries extends ListRecords
|
||||
{
|
||||
protected static string $resource = EntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
139
app/Filament/Resources/Entries/Schemas/EntryForm.php
Normal file
139
app/Filament/Resources/Entries/Schemas/EntryForm.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries\Schemas;
|
||||
|
||||
use App\Models\Author;
|
||||
use App\Models\Game;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class EntryForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('type')
|
||||
->options([
|
||||
'translations' => 'Translations',
|
||||
'romhacks' => 'Romhacks',
|
||||
'homebrew' => 'Homebrew',
|
||||
'utilities' => 'Utilities',
|
||||
'documents' => 'Documents',
|
||||
'lua-scripts' => 'Lua scripts',
|
||||
'tutorials' => 'Tutorials',
|
||||
])
|
||||
->required()
|
||||
->live(),
|
||||
TextInput::make('title')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
Textarea::make('description')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('main_image')
|
||||
->image(),
|
||||
Select::make('state')
|
||||
->options([
|
||||
'draft' => 'Draft',
|
||||
'pending' => 'Pending',
|
||||
'published' => 'Published',
|
||||
'locked' => 'Locked',
|
||||
'hidden' => 'Hidden',
|
||||
])
|
||||
->default('draft')
|
||||
->required(),
|
||||
Toggle::make('featured')
|
||||
->required(),
|
||||
Select::make('game_id')
|
||||
->relationship('game', 'name')
|
||||
->searchable()
|
||||
->default(null)
|
||||
->hidden(fn(Get $get) => $get('type') === 'homebrew')
|
||||
->createOptionForm([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('slug')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Select::make('platform_id')
|
||||
->relationship('platform', 'name')
|
||||
->required(),
|
||||
Select::make('genre_id')
|
||||
->relationship('genre', 'name')
|
||||
->required(),
|
||||
])
|
||||
->createOptionUsing(function (array $data){
|
||||
return Game::create( $data )->id;
|
||||
})
|
||||
,
|
||||
Select::make('platform_id')
|
||||
->relationship('platform', 'name')
|
||||
->default(null)
|
||||
->hidden(fn(Get $get) => in_array( $get('type'), [ 'translations', 'romhacks' ] ) ),
|
||||
Select::make('status_id')
|
||||
->relationship('status', 'id')
|
||||
->default(null),
|
||||
Select::make('authors')
|
||||
->relationship('authors', 'name')
|
||||
->searchable()
|
||||
->multiple()
|
||||
->createOptionForm([
|
||||
TextInput::make('name')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
TextInput::make('website')
|
||||
->url()
|
||||
->maxLength(500)
|
||||
->default(null),
|
||||
TextInput::make('user_id')
|
||||
->numeric()
|
||||
->default(null),
|
||||
])
|
||||
->createOptionUsing(function (array $data){
|
||||
return Author::create( $data )->id;
|
||||
})
|
||||
,
|
||||
Select::make('languages')
|
||||
->relationship('languages', 'name')
|
||||
->multiple()
|
||||
->preload(),
|
||||
Select::make('modifications')
|
||||
->relationship('modifications', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
->hidden(fn(Get $get) => $get('type') !== "romhacks"),
|
||||
TextInput::make('version')
|
||||
->default(null),
|
||||
DatePicker::make('release_date'),
|
||||
Textarea::make('staff_credits')
|
||||
->default(null)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('relevant_link')
|
||||
->default(null),
|
||||
TextInput::make('youtube_link')
|
||||
->default(null),
|
||||
TextInput::make('user_id')
|
||||
->required()
|
||||
->numeric(),
|
||||
TextInput::make('comments_thread_id')
|
||||
->numeric()
|
||||
->default(null),
|
||||
]);
|
||||
}
|
||||
}
|
||||
58
app/Filament/Resources/Entries/Tables/EntriesTable.php
Normal file
58
app/Filament/Resources/Entries/Tables/EntriesTable.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Entries\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class EntriesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('type')
|
||||
->badge(),
|
||||
TextColumn::make('title')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->searchable(),
|
||||
TextColumn::make('state')
|
||||
->badge(),
|
||||
IconColumn::make('featured')
|
||||
->boolean(),
|
||||
TextColumn::make('version')
|
||||
->searchable(),
|
||||
TextColumn::make('user_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('comments_thread_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Games/GameResource.php
Normal file
50
app/Filament/Resources/Games/GameResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games;
|
||||
|
||||
use App\Filament\Resources\Games\Pages\CreateGame;
|
||||
use App\Filament\Resources\Games\Pages\EditGame;
|
||||
use App\Filament\Resources\Games\Pages\ListGames;
|
||||
use App\Filament\Resources\Games\Schemas\GameForm;
|
||||
use App\Filament\Resources\Games\Tables\GamesTable;
|
||||
use App\Models\Game;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GameResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Game::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::PlayCircle;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return GameForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return GamesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListGames::route('/'),
|
||||
'create' => CreateGame::route('/create'),
|
||||
'edit' => EditGame::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Games/Pages/CreateGame.php
Normal file
11
app/Filament/Resources/Games/Pages/CreateGame.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games\Pages;
|
||||
|
||||
use App\Filament\Resources\Games\GameResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGame extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GameResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Games/Pages/EditGame.php
Normal file
19
app/Filament/Resources/Games/Pages/EditGame.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games\Pages;
|
||||
|
||||
use App\Filament\Resources\Games\GameResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditGame extends EditRecord
|
||||
{
|
||||
protected static string $resource = GameResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Games/Pages/ListGames.php
Normal file
19
app/Filament/Resources/Games/Pages/ListGames.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games\Pages;
|
||||
|
||||
use App\Filament\Resources\Games\GameResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListGames extends ListRecords
|
||||
{
|
||||
protected static string $resource = GameResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Filament/Resources/Games/Schemas/GameForm.php
Normal file
29
app/Filament/Resources/Games/Schemas/GameForm.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class GameForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('slug')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Select::make('platform_id')
|
||||
->relationship('platform', 'name')
|
||||
->required(),
|
||||
Select::make('genre_id')
|
||||
->relationship('genre', 'name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
46
app/Filament/Resources/Games/Tables/GamesTable.php
Normal file
46
app/Filament/Resources/Games/Tables/GamesTable.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Games\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GamesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->searchable(),
|
||||
TextColumn::make('platform.name')
|
||||
->searchable(),
|
||||
TextColumn::make('genre.name')
|
||||
->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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Genres/GenreResource.php
Normal file
50
app/Filament/Resources/Genres/GenreResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres;
|
||||
|
||||
use App\Filament\Resources\Genres\Pages\CreateGenre;
|
||||
use App\Filament\Resources\Genres\Pages\EditGenre;
|
||||
use App\Filament\Resources\Genres\Pages\ListGenres;
|
||||
use App\Filament\Resources\Genres\Schemas\GenreForm;
|
||||
use App\Filament\Resources\Genres\Tables\GenresTable;
|
||||
use App\Models\Genre;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GenreResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Genre::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::FingerPrint;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return GenreForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return GenresTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListGenres::route('/'),
|
||||
'create' => CreateGenre::route('/create'),
|
||||
'edit' => EditGenre::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Genres/Pages/CreateGenre.php
Normal file
11
app/Filament/Resources/Genres/Pages/CreateGenre.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres\Pages;
|
||||
|
||||
use App\Filament\Resources\Genres\GenreResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGenre extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GenreResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Genres/Pages/EditGenre.php
Normal file
19
app/Filament/Resources/Genres/Pages/EditGenre.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres\Pages;
|
||||
|
||||
use App\Filament\Resources\Genres\GenreResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditGenre extends EditRecord
|
||||
{
|
||||
protected static string $resource = GenreResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Genres/Pages/ListGenres.php
Normal file
19
app/Filament/Resources/Genres/Pages/ListGenres.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres\Pages;
|
||||
|
||||
use App\Filament\Resources\Genres\GenreResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListGenres extends ListRecords
|
||||
{
|
||||
protected static string $resource = GenreResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Filament/Resources/Genres/Schemas/GenreForm.php
Normal file
22
app/Filament/Resources/Genres/Schemas/GenreForm.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class GenreForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('slug')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
}
|
||||
42
app/Filament/Resources/Genres/Tables/GenresTable.php
Normal file
42
app/Filament/Resources/Genres/Tables/GenresTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Genres\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GenresTable
|
||||
{
|
||||
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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Languages/LanguageResource.php
Normal file
50
app/Filament/Resources/Languages/LanguageResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages;
|
||||
|
||||
use App\Filament\Resources\Languages\Pages\CreateLanguage;
|
||||
use App\Filament\Resources\Languages\Pages\EditLanguage;
|
||||
use App\Filament\Resources\Languages\Pages\ListLanguages;
|
||||
use App\Filament\Resources\Languages\Schemas\LanguageForm;
|
||||
use App\Filament\Resources\Languages\Tables\LanguagesTable;
|
||||
use App\Models\Language;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LanguageResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Language::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::Language;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return LanguageForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LanguagesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListLanguages::route('/'),
|
||||
'create' => CreateLanguage::route('/create'),
|
||||
'edit' => EditLanguage::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Languages/Pages/CreateLanguage.php
Normal file
11
app/Filament/Resources/Languages/Pages/CreateLanguage.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages\Pages;
|
||||
|
||||
use App\Filament\Resources\Languages\LanguageResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateLanguage extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LanguageResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Languages/Pages/EditLanguage.php
Normal file
19
app/Filament/Resources/Languages/Pages/EditLanguage.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages\Pages;
|
||||
|
||||
use App\Filament\Resources\Languages\LanguageResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditLanguage extends EditRecord
|
||||
{
|
||||
protected static string $resource = LanguageResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Languages/Pages/ListLanguages.php
Normal file
19
app/Filament/Resources/Languages/Pages/ListLanguages.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages\Pages;
|
||||
|
||||
use App\Filament\Resources\Languages\LanguageResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListLanguages extends ListRecords
|
||||
{
|
||||
protected static string $resource = LanguageResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Filament/Resources/Languages/Schemas/LanguageForm.php
Normal file
23
app/Filament/Resources/Languages/Schemas/LanguageForm.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LanguageForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
42
app/Filament/Resources/Languages/Tables/LanguagesTable.php
Normal file
42
app/Filament/Resources/Languages/Tables/LanguagesTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Languages\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LanguagesTable
|
||||
{
|
||||
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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications;
|
||||
|
||||
use App\Filament\Resources\Modifications\Pages\CreateModification;
|
||||
use App\Filament\Resources\Modifications\Pages\EditModification;
|
||||
use App\Filament\Resources\Modifications\Pages\ListModifications;
|
||||
use App\Filament\Resources\Modifications\Schemas\ModificationForm;
|
||||
use App\Filament\Resources\Modifications\Tables\ModificationsTable;
|
||||
use App\Models\Modification;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ModificationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Modification::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::ArchiveBox;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ModificationForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ModificationsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListModifications::route('/'),
|
||||
'create' => CreateModification::route('/create'),
|
||||
'edit' => EditModification::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications\Pages;
|
||||
|
||||
use App\Filament\Resources\Modifications\ModificationResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateModification extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ModificationResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications\Pages;
|
||||
|
||||
use App\Filament\Resources\Modifications\ModificationResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditModification extends EditRecord
|
||||
{
|
||||
protected static string $resource = ModificationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications\Pages;
|
||||
|
||||
use App\Filament\Resources\Modifications\ModificationResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListModifications extends ListRecords
|
||||
{
|
||||
protected static string $resource = ModificationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ModificationForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Modifications\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ModificationsTable
|
||||
{
|
||||
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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Platforms/Pages/CreatePlatform.php
Normal file
11
app/Filament/Resources/Platforms/Pages/CreatePlatform.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms\Pages;
|
||||
|
||||
use App\Filament\Resources\Platforms\PlatformResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePlatform extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PlatformResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Platforms/Pages/EditPlatform.php
Normal file
19
app/Filament/Resources/Platforms/Pages/EditPlatform.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms\Pages;
|
||||
|
||||
use App\Filament\Resources\Platforms\PlatformResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPlatform extends EditRecord
|
||||
{
|
||||
protected static string $resource = PlatformResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Platforms/Pages/ListPlatforms.php
Normal file
19
app/Filament/Resources/Platforms/Pages/ListPlatforms.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms\Pages;
|
||||
|
||||
use App\Filament\Resources\Platforms\PlatformResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPlatforms extends ListRecords
|
||||
{
|
||||
protected static string $resource = PlatformResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Platforms/PlatformResource.php
Normal file
50
app/Filament/Resources/Platforms/PlatformResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms;
|
||||
|
||||
use App\Filament\Resources\Platforms\Pages\CreatePlatform;
|
||||
use App\Filament\Resources\Platforms\Pages\EditPlatform;
|
||||
use App\Filament\Resources\Platforms\Pages\ListPlatforms;
|
||||
use App\Filament\Resources\Platforms\Schemas\PlatformForm;
|
||||
use App\Filament\Resources\Platforms\Tables\PlatformsTable;
|
||||
use App\Models\Platform;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PlatformResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Platform::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::Cube;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PlatformForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return PlatformsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListPlatforms::route('/'),
|
||||
'create' => CreatePlatform::route('/create'),
|
||||
'edit' => EditPlatform::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Filament/Resources/Platforms/Schemas/PlatformForm.php
Normal file
26
app/Filament/Resources/Platforms/Schemas/PlatformForm.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class PlatformForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
TextInput::make('slug')
|
||||
->required()
|
||||
->unique( ignoreRecord: true )
|
||||
->maxLength(100),
|
||||
TextInput::make('short_name')
|
||||
->default(null)
|
||||
->maxLength(30),
|
||||
]);
|
||||
}
|
||||
}
|
||||
45
app/Filament/Resources/Platforms/Tables/PlatformsTable.php
Normal file
45
app/Filament/Resources/Platforms/Tables/PlatformsTable.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Platforms\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PlatformsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('slug')
|
||||
->searchable(),
|
||||
TextColumn::make('short_name')
|
||||
->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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
11
app/Filament/Resources/Statuses/Pages/CreateStatus.php
Normal file
11
app/Filament/Resources/Statuses/Pages/CreateStatus.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses\Pages;
|
||||
|
||||
use App\Filament\Resources\Statuses\StatusResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStatus extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StatusResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Statuses/Pages/EditStatus.php
Normal file
19
app/Filament/Resources/Statuses/Pages/EditStatus.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses\Pages;
|
||||
|
||||
use App\Filament\Resources\Statuses\StatusResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStatus extends EditRecord
|
||||
{
|
||||
protected static string $resource = StatusResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Statuses/Pages/ListStatuses.php
Normal file
19
app/Filament/Resources/Statuses/Pages/ListStatuses.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses\Pages;
|
||||
|
||||
use App\Filament\Resources\Statuses\StatusResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatuses extends ListRecords
|
||||
{
|
||||
protected static string $resource = StatusResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Filament/Resources/Statuses/Schemas/StatusForm.php
Normal file
23
app/Filament/Resources/Statuses/Schemas/StatusForm.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatusForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
app/Filament/Resources/Statuses/StatusResource.php
Normal file
50
app/Filament/Resources/Statuses/StatusResource.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses;
|
||||
|
||||
use App\Filament\Resources\Statuses\Pages\CreateStatus;
|
||||
use App\Filament\Resources\Statuses\Pages\EditStatus;
|
||||
use App\Filament\Resources\Statuses\Pages\ListStatuses;
|
||||
use App\Filament\Resources\Statuses\Schemas\StatusForm;
|
||||
use App\Filament\Resources\Statuses\Tables\StatusesTable;
|
||||
use App\Models\Status;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatusResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Status::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::ChartBar;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return StatusForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return StatusesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListStatuses::route('/'),
|
||||
'create' => CreateStatus::route('/create'),
|
||||
'edit' => EditStatus::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Filament/Resources/Statuses/Tables/StatusesTable.php
Normal file
42
app/Filament/Resources/Statuses/Tables/StatusesTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Statuses\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatusesTable
|
||||
{
|
||||
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