migration script

# Conflicts:
#	app/Filament/Resources/Torrent/AnnounceLogResource.php
This commit is contained in:
NekoCH
2025-09-21 18:07:38 +08:00
parent f0b50e4826
commit 532f3bdb3f
131 changed files with 2177 additions and 1644 deletions
@@ -2,13 +2,23 @@
namespace App\Filament\Resources\Section;
use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\Section\CodecResource\Pages\ListCodecs;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
use App\Filament\Resources\Section\CodecResource\Pages\EditCodec;
use App\Filament\Resources\Section\CodecResource\Pages;
use App\Filament\Resources\Section\CodecResource\RelationManagers;
use App\Models\Codec;
use App\Models\Icon;
use App\Models\SearchBox;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables\Table;
use Filament\Tables;
@@ -19,23 +29,23 @@ class CodecResource extends Resource
{
protected static ?string $model = Codec::class;
protected static ?string $navigationIcon = 'heroicon-o-bookmark';
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-bookmark';
protected static ?string $navigationGroup = 'Section';
protected static string | \UnitEnum | null $navigationGroup = 'Section';
protected static ?int $navigationSort = 3;
public static function form(Form $form): Form
public static function form(Schema $schema): Schema
{
return $form
->schema([
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('sort_index')
return $schema
->components([
TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
TextInput::make('sort_index')
->default(0)
->label(__('label.priority'))
->helperText(__('label.priority_help'))
,
Forms\Components\Select::make('mode')
Select::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray())
->label(__('label.search_box.taxonomy.mode'))
->helperText(__('label.search_box.taxonomy.mode_help'))
@@ -47,17 +57,17 @@ class CodecResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('search_box.name')
TextColumn::make('id'),
TextColumn::make('search_box.name')
->label(__('label.search_box.label'))
->formatStateUsing(fn ($record) => $record->search_box->name ?? 'All')
,
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
])
->defaultSort('sort_index', 'desc')
->filters([
Tables\Filters\SelectFilter::make('mode')
SelectFilter::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray())
->label(__('label.search_box.taxonomy.mode'))
->query(function (Builder $query, array $data) {
@@ -69,12 +79,12 @@ class CodecResource extends Resource
})
,
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
->recordActions([
EditAction::make(),
DeleteAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
->toolbarActions([
DeleteBulkAction::make(),
]);
}
@@ -88,9 +98,9 @@ class CodecResource extends Resource
public static function getPages(): array
{
return [
'index' => Pages\ListCodecs::route('/'),
'create' => Pages\CreateCodec::route('/create'),
'edit' => Pages\EditCodec::route('/{record}/edit'),
'index' => ListCodecs::route('/'),
'create' => CreateCodec::route('/create'),
'edit' => EditCodec::route('/{record}/edit'),
];
}
}