Andrew 2 months ago
parent
commit
20fe726b38
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      app/Filament/Resources/BannerResource.php

+ 5
- 3
app/Filament/Resources/BannerResource.php View File

@@ -104,10 +104,12 @@ class BannerResource extends Resource
104 104
                         '1' => 'heroicon-o-photo',
105 105
                         '2' => 'heroicon-o-film',
106 106
                     }),
107
-                ImageColumn::make('img_url')->label('圖片'),
108
-                TextColumn::make('title')->label('標題'),
107
+                ImageColumn::make('img_url')->label('圖片')
108
+                    ->visible(fn($record, $state) => $record->type == 1),
109
+                TextColumn::make('title')->label('標題')
110
+                    ->formatStateUsing(fn($record, $state) => $record->type == 1 ? $state : '-'),
109 111
                 TextColumn::make('video_url')->label('影片網址')
110
-                    ->formatStateUsing(fn($record, $state) => $record->type === '2' ? $state : '-'),
112
+                    ->formatStateUsing(fn($record, $state) => $record->type == 2 ? $state : '-'),
111 113
             ])
112 114
             ->filters([
113 115
                 //