admin torrent add visible filter

This commit is contained in:
xiaomlove
2022-07-05 15:53:06 +08:00
parent b7f3ae25e8
commit 9d07bd58bf
4 changed files with 14 additions and 3 deletions
@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Torrent; namespace App\Filament\Resources\Torrent;
use App\Filament\OptionsTrait;
use App\Filament\Resources\Torrent\TorrentResource\Pages; use App\Filament\Resources\Torrent\TorrentResource\Pages;
use App\Filament\Resources\Torrent\TorrentResource\RelationManagers; use App\Filament\Resources\Torrent\TorrentResource\RelationManagers;
use App\Models\Setting; use App\Models\Setting;
@@ -25,6 +26,8 @@ use Illuminate\Support\Str;
class TorrentResource extends Resource class TorrentResource extends Resource
{ {
use OptionsTrait;
protected static ?string $model = Torrent::class; protected static ?string $model = Torrent::class;
protected static ?string $navigationIcon = 'heroicon-o-collection'; protected static ?string $navigationIcon = 'heroicon-o-collection';
@@ -87,9 +90,9 @@ class TorrentResource extends Resource
]) ])
->defaultSort('id', 'desc') ->defaultSort('id', 'desc')
->filters([ ->filters([
Tables\Filters\SelectFilter::make('approval_status') Tables\Filters\SelectFilter::make('visible')
->options(Torrent::listApprovalStatus(true)) ->options(self::$yesOrNo)
->label(__('label.torrent.approval_status')), ->label(__('label.torrent.visible')),
Tables\Filters\SelectFilter::make('pos_state') Tables\Filters\SelectFilter::make('pos_state')
->options(Torrent::listPosStates(true)) ->options(Torrent::listPosStates(true))
@@ -98,6 +101,11 @@ class TorrentResource extends Resource
Tables\Filters\SelectFilter::make('sp_state') Tables\Filters\SelectFilter::make('sp_state')
->options(Torrent::listPromotionTypes(true)) ->options(Torrent::listPromotionTypes(true))
->label(__('label.torrent.sp_state')), ->label(__('label.torrent.sp_state')),
Tables\Filters\SelectFilter::make('approval_status')
->options(Torrent::listApprovalStatus(true))
->visible($showApproval)
->label(__('label.torrent.approval_status')),
]) ])
->actions([ ->actions([
// Tables\Actions\EditAction::make(), // Tables\Actions\EditAction::make(),
+1
View File
@@ -119,6 +119,7 @@ return [
'approval_status' => 'Approval status', 'approval_status' => 'Approval status',
'pos_state' => 'Pos state', 'pos_state' => 'Pos state',
'sp_state' => 'Promotion', 'sp_state' => 'Promotion',
'visible' => 'Visible',
], ],
'hit_and_run' => [ 'hit_and_run' => [
+1
View File
@@ -118,6 +118,7 @@ return [
'approval_status' => '审核状态', 'approval_status' => '审核状态',
'pos_state' => '置顶', 'pos_state' => '置顶',
'sp_state' => '优惠', 'sp_state' => '优惠',
'visible' => '活种',
], ],
'hit_and_run' => [ 'hit_and_run' => [
+1
View File
@@ -119,6 +119,7 @@ return [
'approval_status' => '審核狀態', 'approval_status' => '審核狀態',
'pos_state' => '置頂', 'pos_state' => '置頂',
'sp_state' => '優惠', 'sp_state' => '優惠',
'visible' => '活種',
], ],
'hit_and_run' => [ 'hit_and_run' => [