Andrew 2 个月前
父节点
当前提交
9c633120fb
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14
    14
      app/Filament/Resources/BannerResource.php

+ 14
- 14
app/Filament/Resources/BannerResource.php 查看文件

@@ -100,28 +100,28 @@ class BannerResource extends Resource
100 100
         return $table
101 101
             ->columns([
102 102
                 IconColumn::make('type')->label('類別')
103
-                    ->icon(fn (string $state): string => match ($state) {
103
+                    ->icon(fn(string $state): string => match ($state) {
104 104
                         '1' => 'heroicon-o-photo',
105 105
                         '2' => 'heroicon-o-film',
106 106
                     }),
107 107
                 ImageColumn::make('img_url')->label('圖片'),
108 108
                 TextColumn::make('title')->label('標題'),
109 109
                 TextColumn::make('video_url')->label('影片網址')
110
-                    ->visible(fn ($state): bool => $state == 2),
110
+                    ->formatStateUsing(fn($record, $state) => $record->type === '2' ? $state : '-'),
111 111
             ])
112 112
             ->filters([
113
-        //
114
-    ])
115
-        ->actions([
116
-            Tables\Actions\EditAction::make(),
117
-        ])
118
-        ->bulkActions([
119
-            Tables\Actions\BulkActionGroup::make([
120
-                Tables\Actions\DeleteBulkAction::make(),
121
-            ]),
122
-        ])
123
-        ->reorderable('order')
124
-        ->defaultSort('order');
113
+                //
114
+            ])
115
+            ->actions([
116
+                Tables\Actions\EditAction::make(),
117
+            ])
118
+            ->bulkActions([
119
+                Tables\Actions\BulkActionGroup::make([
120
+                    Tables\Actions\DeleteBulkAction::make(),
121
+                ]),
122
+            ])
123
+            ->reorderable('order')
124
+            ->defaultSort('order');
125 125
     }
126 126
 
127 127
     public static function getRelations(): array