mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
migration script
# Conflicts: # app/Filament/Resources/Torrent/AnnounceLogResource.php
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\Torrent;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use App\Filament\Resources\Torrent\TorrentOperationLogResource\Pages\ManageTorrentOperationLogs;
|
||||
use App\Filament\Resources\Torrent\TorrentOperationLogResource\Pages;
|
||||
use App\Filament\Resources\Torrent\TorrentOperationLogResource\RelationManagers;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentOperationLog;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -18,9 +23,9 @@ class TorrentOperationLogResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TorrentOperationLog::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Torrent';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Torrent';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
@@ -34,10 +39,10 @@ class TorrentOperationLogResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -46,58 +51,58 @@ class TorrentOperationLogResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('user.username')
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('user.username')
|
||||
->formatStateUsing(fn ($record) => username_for_admin($record->uid))
|
||||
->label(__('label.user.label'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('torrent.name')
|
||||
TextColumn::make('torrent.name')
|
||||
->formatStateUsing(fn ($record) => torrent_name_for_admin($record->torrent))
|
||||
->label(__('label.torrent.label'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('action_type_text')
|
||||
TextColumn::make('action_type_text')
|
||||
->label(__('torrent-operation-log.fields.action_type'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('comment')
|
||||
TextColumn::make('comment')
|
||||
->label(__('label.comment'))
|
||||
,
|
||||
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
TextColumn::make('created_at')
|
||||
->formatStateUsing(fn ($state) => format_datetime($state))
|
||||
->label(__('label.created_at'))
|
||||
,
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('uid')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('uid')
|
||||
Filter::make('uid')
|
||||
->schema([
|
||||
TextInput::make('uid')
|
||||
->placeholder('UID')
|
||||
,
|
||||
])->query(function (Builder $query, array $data) {
|
||||
return $query->when($data['uid'], fn (Builder $query, $value) => $query->where("uid", $value));
|
||||
})
|
||||
,
|
||||
Tables\Filters\Filter::make('torrent_id')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('torrent_id')
|
||||
Filter::make('torrent_id')
|
||||
->schema([
|
||||
TextInput::make('torrent_id')
|
||||
->placeholder('Torrent ID')
|
||||
,
|
||||
])->query(function (Builder $query, array $data) {
|
||||
return $query->when($data['torrent_id'], fn (Builder $query, $value) => $query->where("torrent_id", $value));
|
||||
})
|
||||
,
|
||||
Tables\Filters\SelectFilter::make('action_type')
|
||||
SelectFilter::make('action_type')
|
||||
->options(TorrentOperationLog::listStaticProps(TorrentOperationLog::$actionTypes, 'torrent.operation_log.%s.type_text', true))
|
||||
->label(__('torrent-operation-log.fields.action_type'))
|
||||
->multiple()
|
||||
,
|
||||
])
|
||||
->actions([
|
||||
->recordActions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
// Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
->toolbarActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
@@ -105,7 +110,7 @@ class TorrentOperationLogResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageTorrentOperationLogs::route('/'),
|
||||
'index' => ManageTorrentOperationLogs::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user