Andrew 2 месяцев назад
Родитель
Сommit
9c633120fb
1 измененных файлов: 14 добавлений и 14 удалений
  1. 14
    14
      app/Filament/Resources/BannerResource.php

+ 14
- 14
app/Filament/Resources/BannerResource.php Просмотреть файл

100
         return $table
100
         return $table
101
             ->columns([
101
             ->columns([
102
                 IconColumn::make('type')->label('類別')
102
                 IconColumn::make('type')->label('類別')
103
-                    ->icon(fn (string $state): string => match ($state) {
103
+                    ->icon(fn(string $state): string => match ($state) {
104
                         '1' => 'heroicon-o-photo',
104
                         '1' => 'heroicon-o-photo',
105
                         '2' => 'heroicon-o-film',
105
                         '2' => 'heroicon-o-film',
106
                     }),
106
                     }),
107
                 ImageColumn::make('img_url')->label('圖片'),
107
                 ImageColumn::make('img_url')->label('圖片'),
108
                 TextColumn::make('title')->label('標題'),
108
                 TextColumn::make('title')->label('標題'),
109
                 TextColumn::make('video_url')->label('影片網址')
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
             ->filters([
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
     public static function getRelations(): array
127
     public static function getRelations(): array