@@ -85,20 +85,20 @@ public function mount(?int $modelId = null, ?string $modelClass = null): void
8585
8686 $ this ->modelClass = $ this ->modelClass ? str_replace ('\\\\' , '\\' , $ this ->modelClass ) : null ;
8787
88- if ($ this ->modelClass && !class_exists ($ this ->modelClass )) {
88+ if ($ this ->modelClass && ! class_exists ($ this ->modelClass )) {
8989 throw new Exception (__ ('media::fields.class_not_found ' , ['class ' => $ this ->modelClass ]));
9090 }
9191
9292 if ($ this ->modelId && $ this ->modelClass ) {
9393 $ this ->model = app ($ this ->modelClass )::find ($ this ->modelId );
9494 }
9595
96- if (!$ this ->modelId || !$ this ->model ) {
96+ if (! $ this ->modelId || ! $ this ->model ) {
9797 $ this ->modelId = 0 ;
9898 }
9999
100100 $ firstCollection = MediaCollection::first ();
101- if (!$ firstCollection ) {
101+ if (! $ firstCollection ) {
102102 $ firstCollection = MediaCollection::create ([
103103 'name ' => __ ('media::fields.uncategorized ' ),
104104 'description ' => __ ('media::fields.uncategorized_description ' ),
@@ -111,15 +111,15 @@ public function form(Schema $schema): Schema
111111 {
112112 $ collection = Select::make ('media_collection_id ' )
113113 ->label (__ ('media::fields.collection ' ))
114- ->options (fn () => MediaCollection::all ()->pluck ('name ' , 'id ' )->toArray ())
114+ ->options (fn () => MediaCollection::all ()->pluck ('name ' , 'id ' )->toArray ())
115115 ->searchable ()
116116 ->default (function () {
117117 $ name = __ ('media::fields.uncategorized ' );
118118 $ description = __ ('media::fields.uncategorized_description ' );
119119
120- $ collection = MediaCollection::all ()->first (fn ($ c ) => $ c ->name === $ name );
120+ $ collection = MediaCollection::all ()->first (fn ($ c ) => $ c ->name === $ name );
121121
122- if (!$ collection ) {
122+ if (! $ collection ) {
123123 $ collection = MediaCollection::create ([
124124 'name ' => $ name ,
125125 'description ' => $ description ,
@@ -135,7 +135,7 @@ public function form(Schema $schema): Schema
135135 ->label (__ ('media::fields.upload ' ))
136136 ->live ()
137137 ->afterStateUpdated (function ($ state , $ get ) {
138- if (!$ state ) {
138+ if (! $ state ) {
139139 return ;
140140 }
141141
@@ -282,7 +282,7 @@ public function toggleMediaSelection(int $mediaId)
282282 $ this ->selectedMediaIds [] = $ mediaId ;
283283 }
284284 } else {
285- if (!empty ($ this ->selectedMediaIds ) && $ this ->selectedMediaIds [0 ] === $ mediaId ) {
285+ if (! empty ($ this ->selectedMediaIds ) && $ this ->selectedMediaIds [0 ] === $ mediaId ) {
286286 $ this ->selectedMediaIds = [];
287287 } else {
288288 $ this ->selectedMediaIds = [$ mediaId ];
@@ -297,7 +297,7 @@ public function toggleMediaSelection(int $mediaId)
297297 if (isset ($ media ->uploader ->name )) {
298298 $ uploaderName = $ media ->uploader ->name ;
299299 } elseif (isset ($ media ->uploader ->first_name ) && isset ($ media ->uploader ->last_name )) {
300- $ uploaderName = $ media ->uploader ->first_name . ' ' . $ media ->uploader ->last_name ;
300+ $ uploaderName = $ media ->uploader ->first_name . ' ' . $ media ->uploader ->last_name ;
301301 }
302302 }
303303
@@ -344,7 +344,7 @@ public function applySelection()
344344 $ selectedMedia = Media::whereIn ('id ' , $ this ->selectedMediaIds )->get ();
345345
346346 if ($ selectedMedia ->isNotEmpty ()) {
347- if (!$ this ->multiple ) {
347+ if (! $ this ->multiple ) {
348348 $ media = $ selectedMedia ->first ();
349349 $ this ->dispatch ('mediaSelected ' , [
350350 'id ' => $ media ->id ,
@@ -354,7 +354,7 @@ public function applySelection()
354354 'name ' => $ media ->getAttribute ('name ' ),
355355 ]);
356356 } else {
357- $ selectedMediaData = $ selectedMedia ->map (fn ($ media ) => [
357+ $ selectedMediaData = $ selectedMedia ->map (fn ($ media ) => [
358358 'id ' => $ media ->id ,
359359 'url ' => $ media ->getUrl (),
360360 'file_name ' => $ media ->file_name ,
@@ -414,11 +414,11 @@ public function render()
414414 $ media = Media::query ()
415415 ->when ($ this ->searchQuery , function ($ query ) {
416416 $ query ->where (function ($ subQuery ) {
417- $ subQuery ->where ('file_name ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
417+ $ subQuery ->where ('file_name ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
418418 ->orWhereHas ('translations ' , function ($ query ) {
419- $ query ->where ('title ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
420- ->orWhere ('description ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
421- ->orWhere ('alt ' , 'like ' , '% ' . $ this ->searchQuery . '% ' );
419+ $ query ->where ('title ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
420+ ->orWhere ('description ' , 'like ' , '% ' . $ this ->searchQuery . '% ' )
421+ ->orWhere ('alt ' , 'like ' , '% ' . $ this ->searchQuery . '% ' );
422422 });
423423 });
424424 })
@@ -503,25 +503,25 @@ public function render()
503503 $ uploader = $ media ->uploader ;
504504 if ($ uploader && method_exists ($ uploader , 'getName ' )) {
505505 return [
506- 'id ' => $ media ->uploader_type . ':: ' . $ media ->uploader_id ,
506+ 'id ' => $ media ->uploader_type . ':: ' . $ media ->uploader_id ,
507507 'name ' => $ uploader ->getName (),
508508 ];
509509 }
510510 if ($ uploader && isset ($ uploader ->name )) {
511511 return [
512- 'id ' => $ media ->uploader_type . ':: ' . $ media ->uploader_id ,
512+ 'id ' => $ media ->uploader_type . ':: ' . $ media ->uploader_id ,
513513 'name ' => $ uploader ->name ,
514514 ];
515515 }
516516
517517 return null ;
518518 })
519519 ->filter ()
520- ->unique (fn (array $ item ): string => $ item ['id ' ])
520+ ->unique (fn (array $ item ): string => $ item ['id ' ])
521521 ->pluck ('name ' , 'id ' )
522522 ->toArray ();
523523
524- if (!empty ($ uploaders )) {
524+ if (! empty ($ uploaders )) {
525525 $ typeName = class_basename ($ type );
526526 $ uploaderOptions [$ typeName ] = $ uploaders ;
527527 }
0 commit comments