Files

80 lines
2.4 KiB
PHP
Raw Permalink Normal View History

2022-08-16 18:31:04 +08:00
<?php
namespace App\Filament\Resources\Torrent;
2025-09-21 18:07:38 +08:00
use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Columns\TextColumn;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\Torrent\TorrentDenyReasonResource\Pages\ManageTorrentDenyReasons;
2022-08-16 18:31:04 +08:00
use App\Filament\Resources\Torrent\TorrentDenyReasonResource\Pages;
use App\Filament\Resources\Torrent\TorrentDenyReasonResource\RelationManagers;
use App\Models\TorrentDenyReason;
use Filament\Forms;
use Filament\Resources\Resource;
2024-12-25 23:09:07 +08:00
use Filament\Tables\Table;
2022-08-16 18:31:04 +08:00
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class TorrentDenyReasonResource extends Resource
{
protected static ?string $model = TorrentDenyReason::class;
2025-09-21 18:07:38 +08:00
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-no-symbol';
2022-08-16 18:31:04 +08:00
2025-09-21 18:07:38 +08:00
protected static string | \UnitEnum | null $navigationGroup = 'Torrent';
2022-08-16 18:31:04 +08:00
protected static ?int $navigationSort = 3;
2024-12-25 23:09:07 +08:00
public static function getNavigationLabel(): string
2022-08-16 18:31:04 +08:00
{
return __('admin.sidebar.torrent_deny_reason');
}
public static function getBreadcrumb(): string
{
return self::getNavigationLabel();
}
2025-09-21 18:07:38 +08:00
public static function form(Schema $schema): Schema
2022-08-16 18:31:04 +08:00
{
2025-09-21 18:07:38 +08:00
return $schema
->components([
TextInput::make('name')->required()->label(__('label.name')),
TextInput::make('priority')->integer()->label(__('label.priority'))->default(0),
2022-08-16 18:31:04 +08:00
])->columns(1);
}
public static function table(Table $table): Table
{
return $table
->columns([
2025-09-21 18:07:38 +08:00
TextColumn::make('id'),
TextColumn::make('name')->label(__('label.name')),
TextColumn::make('priority')->label(__('label.priority'))->sortable(),
TextColumn::make('created_at')->label(__('label.created_at')),
2022-08-16 18:31:04 +08:00
])
->defaultSort('priority', 'desc')
->filters([
//
])
2025-09-21 18:07:38 +08:00
->recordActions([
EditAction::make(),
DeleteAction::make(),
2022-08-16 18:31:04 +08:00
])
2025-09-21 18:07:38 +08:00
->toolbarActions([
DeleteBulkAction::make(),
2022-08-16 18:31:04 +08:00
]);
}
public static function getPages(): array
{
return [
2025-09-21 18:07:38 +08:00
'index' => ManageTorrentDenyReasons::route('/'),
2022-08-16 18:31:04 +08:00
];
}
}