mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
skip offer + pt-gen fill subtitle
This commit is contained in:
@@ -61,15 +61,14 @@ class TagResource extends Resource
|
||||
Tables\Columns\TextColumn::make('padding')->label(__('label.tag.padding')),
|
||||
Tables\Columns\TextColumn::make('border_radius')->label(__('label.tag.border_radius')),
|
||||
Tables\Columns\TextColumn::make('priority')->label(__('label.priority'))->sortable(),
|
||||
Tables\Columns\TextColumn::make('torrents_count')->label(__('label.tag.torrents_count')),
|
||||
Tables\Columns\TextColumn::make('updated_at')->dateTime()->label(__('label.updated_at')),
|
||||
])
|
||||
->defaultSort('priority', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->actions(self::getActions())
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
@@ -90,4 +89,17 @@ class TagResource extends Resource
|
||||
'edit' => Pages\EditTag::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
private static function getActions(): array
|
||||
{
|
||||
$actions = [];
|
||||
$actions[] = Tables\Actions\Action::make('detach_torrents')
|
||||
->label(__('admin.resources.tag.detach_torrents'))
|
||||
->requiresConfirmation()
|
||||
->action(function ($record) {
|
||||
$record->torrent_tags()->delete();
|
||||
});
|
||||
$actions[] = Tables\Actions\EditAction::make();
|
||||
return $actions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace App\Filament\Resources\Torrent\TagResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Torrent\TagResource;
|
||||
use App\Models\Tag;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListTags extends PageList
|
||||
{
|
||||
@@ -17,4 +19,11 @@ class ListTags extends PageList
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Tag::query()->withCount('torrents');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ class Tag extends NexusModel
|
||||
return $this->belongsToMany(Torrent::class, 'torrent_tags', 'tag_id', 'torrent_id');
|
||||
}
|
||||
|
||||
public function torrent_tags(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(TorrentTag::class, 'tag_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user