22
33namespace Moox \Media \Resources ;
44
5- use Filament \Forms \Form ;
6- use Filament \Tables \Table ;
7- use Filament \Support \RawJs ;
8- use Illuminate \Support \Str ;
9- use Moox \Media \Models \Media ;
105use Filament \Facades \Filament ;
11- use Filament \Resources \Resource ;
12- use Illuminate \Support \Facades \Log ;
13- use Illuminate \Support \Facades \Blade ;
6+ use Filament \Forms \Components \Placeholder ;
147use Filament \Forms \Components \Section ;
158use Filament \Forms \Components \Textarea ;
16- use Filament \Tables \Actions \EditAction ;
179use Filament \Forms \Components \TextInput ;
10+ use Filament \Forms \Form ;
1811use Filament \Notifications \Notification ;
12+ use Filament \Resources \Resource ;
13+ use Filament \Support \RawJs ;
14+ use Filament \Tables \Actions \EditAction ;
1915use Filament \Tables \Columns \Layout \Stack ;
2016use Filament \Tables \Filters \SelectFilter ;
17+ use Filament \Tables \Table ;
2118use Illuminate \Database \Eloquent \Builder ;
19+ use Illuminate \Support \Facades \Blade ;
20+ use Illuminate \Support \Facades \Log ;
21+ use Illuminate \Support \Str ;
2222use Moox \Core \Traits \Base \BaseInResource ;
23- use Filament \Forms \Components \Placeholder ;
2423use Moox \Media \Forms \Components \ImageDisplay ;
24+ use Moox \Media \Models \Media ;
2525use Moox \Media \Resources \MediaResource \Pages ;
2626use Moox \Media \Tables \Columns \CustomImageColumn ;
2727
@@ -57,35 +57,35 @@ public static function form(Form $form): Form
5757 ->schema ([
5858 Placeholder::make ('mime_type ' )
5959 ->label ('Dateityp ' )
60- ->content (fn ($ record ) => $ record ->getReadableMimeType ()),
60+ ->content (fn ($ record ) => $ record ->getReadableMimeType ()),
6161
6262 Placeholder::make ('size ' )
6363 ->label ('Dateigröße ' )
64- ->content (fn ($ record ) => number_format ($ record ->size / 1024 , 2 ) . ' KB ' ),
64+ ->content (fn ($ record ) => number_format ($ record ->size / 1024 , 2 ). ' KB ' ),
6565
6666 Placeholder::make ('file_name ' )
6767 ->label ('Originaldateiname ' )
68- ->content (fn ($ record ) => $ record ->file_name ),
68+ ->content (fn ($ record ) => $ record ->file_name ),
6969
7070 Placeholder::make ('dimensions ' )
7171 ->label ('Abmessungen ' )
7272 ->content (function ($ record ) {
7373 $ dimensions = $ record ->getCustomProperty ('dimensions ' );
74- if (!$ dimensions ) {
74+ if (! $ dimensions ) {
7575 return '- ' ;
7676 }
7777
7878 return "{$ dimensions ['width ' ]} × {$ dimensions ['height ' ]} Pixel " ;
7979 })
80- ->visible (fn ($ record ) => str_starts_with ($ record ->mime_type , 'image/ ' )),
80+ ->visible (fn ($ record ) => str_starts_with ($ record ->mime_type , 'image/ ' )),
8181
8282 Placeholder::make ('created_at ' )
8383 ->label ('Hochgeladen am ' )
84- ->content (fn ($ record ) => $ record ->created_at ?->format('d.m.Y H:i ' )),
84+ ->content (fn ($ record ) => $ record ->created_at ?->format('d.m.Y H:i ' )),
8585
8686 Placeholder::make ('updated_at ' )
8787 ->label ('Zuletzt bearbeitet ' )
88- ->content (fn ($ record ) => $ record ->updated_at ?->format('d.m.Y H:i ' )),
88+ ->content (fn ($ record ) => $ record ->updated_at ?->format('d.m.Y H:i ' )),
8989
9090 Placeholder::make ('usage ' )
9191 ->label ('Verwendet in ' )
@@ -100,7 +100,7 @@ public static function form(Form $form): Form
100100
101101 $ links = $ usages ->map (function ($ usage ) {
102102 $ type = Str::plural (strtolower (class_basename ($ usage ->media_usable_type )));
103- $ url = Filament::getCurrentPanel ()->getUrl () . '/ ' . $ type . '/ ' . $ usage ->media_usable_id ;
103+ $ url = Filament::getCurrentPanel ()->getUrl (). '/ ' . $ type. '/ ' . $ usage ->media_usable_id ;
104104
105105 return Blade::render ('<a href="{{ $url }}" target="_blank" class="text-primary underline">{{ $url }}</a> ' , [
106106 'url ' => $ url ,
@@ -155,7 +155,7 @@ public static function table(Table $table): Table
155155 'class ' => 'rounded-lg ' ,
156156 'style ' => 'width: 100%; height: auto; min-width: 150px; max-width: 250px; aspect-ratio: 1/1; object-fit: cover; ' ,
157157 ])
158- ->tooltip (fn ($ record ) => $ record ->title ?? 'Kein Titel ' )
158+ ->tooltip (fn ($ record ) => $ record ->title ?? 'Kein Titel ' )
159159 ->searchable (['name ' , 'title ' , 'description ' , 'alt ' , 'internal_note ' ]),
160160 ]),
161161 ])
@@ -172,7 +172,7 @@ public static function table(Table $table): Table
172172 ->color ('danger ' )
173173 ->icon ('heroicon-m-trash ' )
174174 ->requiresConfirmation ()
175- ->modalHeading (fn ($ record ) => 'Bild " ' . ($ record ->title ?: $ record ->name ) . '" löschen ' )
175+ ->modalHeading (fn ($ record ) => 'Bild " ' . ($ record ->title ?: $ record ->name ). '" löschen ' )
176176 ->modalDescription ('Sind Sie sicher, dass Sie dieses Bild löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden. ' )
177177 ->modalSubmitActionLabel ('Ja, löschen ' )
178178 ->modalCancelActionLabel ('Abbrechen ' )
@@ -185,20 +185,20 @@ public static function table(Table $table): Table
185185 Notification::make ()
186186 ->success ()
187187 ->title ('Medium erfolgreich gelöscht ' )
188- ->body ('Die Datei " ' . $ fileName . '" wurde erfolgreich gelöscht. ' )
188+ ->body ('Die Datei " ' . $ fileName. '" wurde erfolgreich gelöscht. ' )
189189 ->send ();
190190
191191 return redirect (static ::getUrl ('index ' ));
192192 } catch (\Exception $ e ) {
193- Log::error ('Media deletion failed: ' . $ e ->getMessage (), [
193+ Log::error ('Media deletion failed: ' . $ e ->getMessage (), [
194194 'media_id ' => $ record ->id ,
195- 'file_name ' => $ record ->file_name
195+ 'file_name ' => $ record ->file_name ,
196196 ]);
197197
198198 Notification::make ()
199199 ->danger ()
200200 ->title ('Fehler beim Löschen ' )
201- ->body ('Die Datei " ' . $ record ->file_name . '" konnte nicht gelöscht werden. ' )
201+ ->body ('Die Datei " ' . $ record ->file_name . '" konnte nicht gelöscht werden. ' )
202202 ->persistent ()
203203 ->send ();
204204
@@ -217,7 +217,7 @@ public static function table(Table $table): Table
217217 'documents ' => 'Dokumente ' ,
218218 ])
219219 ->query (function (Builder $ query , array $ data ) {
220- if (!$ data ['value ' ]) {
220+ if (! $ data ['value ' ]) {
221221 return $ query ;
222222 }
223223
@@ -262,7 +262,7 @@ public static function table(Table $table): Table
262262 'year ' => 'Dieses Jahr ' ,
263263 ])
264264 ->query (function (Builder $ query , array $ data ) {
265- if (!$ data ['value ' ]) {
265+ if (! $ data ['value ' ]) {
266266 return $ query ;
267267 }
268268
0 commit comments