@@ -70,15 +70,15 @@ public function mount(?int $modelId = null, ?string $modelClass = null): void
7070
7171 $ this ->modelClass = $ this ->modelClass ? str_replace ('\\\\' , '\\' , $ this ->modelClass ) : null ;
7272
73- if ($ this ->modelClass && !class_exists ($ this ->modelClass )) {
73+ if ($ this ->modelClass && ! class_exists ($ this ->modelClass )) {
7474 throw new \Exception (__ ('media::fields.class_not_found ' , ['class ' => $ this ->modelClass ]));
7575 }
7676
7777 if ($ this ->modelId && $ this ->modelClass ) {
7878 $ this ->model = app ($ this ->modelClass )::find ($ this ->modelId );
7979 }
8080
81- if (!$ this ->modelId || !$ this ->model ) {
81+ if (! $ this ->modelId || ! $ this ->model ) {
8282 $ this ->modelId = 0 ;
8383 }
8484 }
@@ -88,13 +88,13 @@ public function form(Form $form): Form
8888 $ upload = FileUpload::make (__ ('files ' ))
8989 ->label (__ ('media::fields.upload ' ))
9090 ->afterStateUpdated (function ($ state ) {
91- if (!$ state ) {
91+ if (! $ state ) {
9292 return ;
9393 }
9494
9595 $ processedFiles = session ('processed_files ' , []);
9696
97- if (!is_array ($ state )) {
97+ if (! is_array ($ state )) {
9898 $ model = new Media ;
9999 $ model ->exists = true ;
100100
@@ -238,7 +238,7 @@ public function toggleMediaSelection(int $mediaId)
238238 $ this ->selectedMediaIds [] = $ mediaId ;
239239 }
240240 } else {
241- if (!empty ($ this ->selectedMediaIds ) && $ this ->selectedMediaIds [0 ] === $ mediaId ) {
241+ if (! empty ($ this ->selectedMediaIds ) && $ this ->selectedMediaIds [0 ] === $ mediaId ) {
242242 $ this ->selectedMediaIds = [];
243243 } else {
244244 $ this ->selectedMediaIds = [$ mediaId ];
@@ -277,7 +277,7 @@ public function applySelection()
277277 $ selectedMedia = Media::whereIn ('id ' , $ this ->selectedMediaIds )->get ();
278278
279279 if ($ selectedMedia ->isNotEmpty ()) {
280- if (!$ this ->multiple ) {
280+ if (! $ this ->multiple ) {
281281 $ media = $ selectedMedia ->first ();
282282 $ this ->dispatch ('mediaSelected ' , [
283283 'id ' => $ media ->id ,
@@ -287,7 +287,7 @@ public function applySelection()
287287 'name ' => $ media ->getAttribute ('name ' ),
288288 ]);
289289 } else {
290- $ selectedMediaData = $ selectedMedia ->map (fn ($ media ) => [
290+ $ selectedMediaData = $ selectedMedia ->map (fn ($ media ) => [
291291 'id ' => $ media ->id ,
292292 'url ' => $ media ->getUrl (),
293293 'file_name ' => $ media ->file_name ,
@@ -340,10 +340,10 @@ public function render()
340340 $ media = Media::query ()
341341 ->when ($ this ->searchQuery , function ($ query ) {
342342 $ query ->where (function ($ subQuery ) {
343- $ subQuery ->where ('file_name ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
344- ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.title")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ) . '% ' ])
345- ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.description")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ) . '% ' ])
346- ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.alt")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ) . '% ' ]);
343+ $ subQuery ->where ('file_name ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
344+ ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.title")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ). '% ' ])
345+ ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.description")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ). '% ' ])
346+ ->orWhereRaw ('LOWER(JSON_EXTRACT(translations, "$.*.alt")) LIKE ? ' , ['% ' . strtolower ($ this ->searchQuery ). '% ' ]);
347347 });
348348 })
349349 ->when ($ this ->fileTypeFilter , function ($ query ) {
0 commit comments