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
+39 -29
View File
@@ -2,13 +2,23 @@
namespace App\Filament\Resources\Section;
use Filament\Schemas\Schema;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Radio;
use Filament\Tables\Columns\TextColumn;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\Section\IconResource\Pages\ListIcons;
use App\Filament\Resources\Section\IconResource\Pages\CreateIcon;
use App\Filament\Resources\Section\IconResource\Pages\EditIcon;
use App\Filament\OptionsTrait;
use App\Filament\EditRedirectIndexTrait;
use App\Filament\Resources\Section\IconResource\Pages;
use App\Filament\Resources\Section\IconResource\RelationManagers;
use App\Models\Icon;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables\Table;
use Filament\Tables;
@@ -21,9 +31,9 @@ class IconResource extends Resource
protected static ?string $model = Icon::class;
protected static ?string $navigationIcon = 'heroicon-o-ticket';
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-ticket';
protected static ?string $navigationGroup = 'Section';
protected static string | \UnitEnum | null $navigationGroup = 'Section';
protected static ?int $navigationSort = 10;
@@ -37,40 +47,40 @@ class IconResource extends Resource
return self::getNavigationLabel();
}
public static function form(Form $form): Form
public static function form(Schema $schema): Schema
{
return $form
->schema([
Forms\Components\Textarea::make('tip')
return $schema
->components([
Textarea::make('tip')
->default(nexus_trans('label.icon.desc'))
->disabled()
->columnSpanFull()
->rows(18)
,
Forms\Components\TextInput::make('name')
TextInput::make('name')
->label(__('label.name'))
->required()
,
Forms\Components\TextInput::make('folder')
TextInput::make('folder')
->label(__('label.icon.folder'))
->required()
->helperText(__('label.icon.folder_help'))
,
Forms\Components\Radio::make('multilang')
Radio::make('multilang')
->label(__('label.icon.multilang'))
->options(self::$yesOrNo)
->required()
->helperText(__('label.icon.multilang_help'))
,
Forms\Components\Radio::make('secondicon')
Radio::make('secondicon')
->label(__('label.icon.secondicon'))
->options(self::$yesOrNo)
->required()
->helperText(__('label.icon.secondicon_help'))
,
Forms\Components\TextInput::make('cssfile')->label(__('label.icon.cssfile'))->helperText(__('label.icon.cssfile_help')),
Forms\Components\TextInput::make('designer')->label(__('label.icon.designer'))->helperText(__('label.icon.designer_help')),
Forms\Components\Textarea::make('comment')->label(__('label.icon.comment'))->helperText(__('label.icon.comment_help')),
TextInput::make('cssfile')->label(__('label.icon.cssfile'))->helperText(__('label.icon.cssfile_help')),
TextInput::make('designer')->label(__('label.icon.designer'))->helperText(__('label.icon.designer_help')),
Textarea::make('comment')->label(__('label.icon.comment'))->helperText(__('label.icon.comment_help')),
]);
}
@@ -78,23 +88,23 @@ class IconResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
Tables\Columns\TextColumn::make('folder')->label(__('label.icon.folder')),
Tables\Columns\TextColumn::make('multilang')->label(__('label.icon.multilang')),
Tables\Columns\TextColumn::make('secondicon')->label(__('label.icon.secondicon')),
Tables\Columns\TextColumn::make('cssfile')->label(__('label.icon.cssfile')),
Tables\Columns\TextColumn::make('designer')->label(__('label.icon.designer')),
TextColumn::make('id'),
TextColumn::make('name')->label(__('label.name')),
TextColumn::make('folder')->label(__('label.icon.folder')),
TextColumn::make('multilang')->label(__('label.icon.multilang')),
TextColumn::make('secondicon')->label(__('label.icon.secondicon')),
TextColumn::make('cssfile')->label(__('label.icon.cssfile')),
TextColumn::make('designer')->label(__('label.icon.designer')),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
->recordActions([
EditAction::make(),
DeleteAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
->toolbarActions([
DeleteBulkAction::make(),
]);
}
@@ -108,9 +118,9 @@ class IconResource extends Resource
public static function getPages(): array
{
return [
'index' => Pages\ListIcons::route('/'),
'create' => Pages\CreateIcon::route('/create'),
'edit' => Pages\EditIcon::route('/{record}/edit'),
'index' => ListIcons::route('/'),
'create' => CreateIcon::route('/create'),
'edit' => EditIcon::route('/{record}/edit'),
];
}
}