@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | $temporaryUpload = $temporaryUploadModelClass::findByMediaUuidInCurrentSession($this->value['uuid']); |
| 24 | 24 | |
| 25 | - if (! $temporaryUpload) { |
|
| 25 | + if (!$temporaryUpload) { |
|
| 26 | 26 | return null; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->prepareForValidation(); |
| 26 | 26 | |
| 27 | - if (! $this->passesAuthorization()) { |
|
| 27 | + if (!$this->passesAuthorization()) { |
|
| 28 | 28 | $this->failedAuthorization(); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $remainingRules[$attribute][] = $rule; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $minimumRuleUsed = collect($remainingRules[$attribute])->contains(function ($rule) { |
|
| 92 | + $minimumRuleUsed = collect($remainingRules[$attribute])->contains(function($rule) { |
|
| 93 | 93 | if (is_string($rule)) { |
| 94 | 94 | return false; |
| 95 | 95 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | { |
| 36 | 36 | return new HtmlString(implode(PHP_EOL, [ |
| 37 | 37 | 'x-data', |
| 38 | - 'x-on:keyup.debounce.' . $debounceInMs . '="$wire.setCustomProperty(\'' . $this->uuid .'\', \'' . $name . '\', document.getElementsByName(\'' . $this->customPropertyAttributeName($name) .'\')[0].value)"', |
|
| 38 | + 'x-on:keyup.debounce.'.$debounceInMs.'="$wire.setCustomProperty(\''.$this->uuid.'\', \''.$name.'\', document.getElementsByName(\''.$this->customPropertyAttributeName($name).'\')[0].value)"', |
|
| 39 | 39 | $this->customPropertyAttributes($name), |
| 40 | 40 | ])); |
| 41 | 41 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | ) { |
| 38 | 38 | $temporaryUploadModelClass = config('media-library.temporary_upload_model'); |
| 39 | 39 | |
| 40 | - if (! $temporaryUpload = $temporaryUploadModelClass::findByMediaUuidInCurrentSession($uuid)) { |
|
| 40 | + if (!$temporaryUpload = $temporaryUploadModelClass::findByMediaUuidInCurrentSession($uuid)) { |
|
| 41 | 41 | throw new Exception('invalid uuid'); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function getCustomProperties(array $customPropertyNames): array |
| 70 | 70 | { |
| 71 | - if (! count($customPropertyNames)) { |
|
| 71 | + if (!count($customPropertyNames)) { |
|
| 72 | 72 | return $this->customProperties; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $callable = $mediaName; |
| 40 | 40 | |
| 41 | - $this->mediaLibraryRequestItems->each(function (MediaLibraryRequestItem $mediaLibraryRequestItem) use ($callable) { |
|
| 41 | + $this->mediaLibraryRequestItems->each(function(MediaLibraryRequestItem $mediaLibraryRequestItem) use ($callable) { |
|
| 42 | 42 | $name = $callable($mediaLibraryRequestItem); |
| 43 | 43 | |
| 44 | 44 | $mediaLibraryRequestItem->name = $name; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $callable = $fileName; |
| 57 | 57 | |
| 58 | - $this->mediaLibraryRequestItems->each(function (MediaLibraryRequestItem $mediaLibraryRequestItem) use ($callable) { |
|
| 58 | + $this->mediaLibraryRequestItems->each(function(MediaLibraryRequestItem $mediaLibraryRequestItem) use ($callable) { |
|
| 59 | 59 | $fileName = $callable($mediaLibraryRequestItem); |
| 60 | 60 | |
| 61 | 61 | $mediaLibraryRequestItem->fileName = $fileName; |
@@ -88,23 +88,23 @@ discard block |
||
| 88 | 88 | $mediaLibraryRequestHandler = MediaLibraryRequestHandler::createForMediaLibraryRequestItems($this->model, $this->mediaLibraryRequestItems, $collectionName) |
| 89 | 89 | ->updateExistingMedia(); |
| 90 | 90 | |
| 91 | - if (! $this->preserveExisting) { |
|
| 91 | + if (!$this->preserveExisting) { |
|
| 92 | 92 | $mediaLibraryRequestHandler->deleteObsoleteMedia(); |
| 93 | 93 | } |
| 94 | 94 | $mediaLibraryRequestHandler |
| 95 | 95 | ->getPendingMediaItems() |
| 96 | - ->each(function (PendingMediaItem $pendingMedia) use ($diskName, $collectionName) { |
|
| 96 | + ->each(function(PendingMediaItem $pendingMedia) use ($diskName, $collectionName) { |
|
| 97 | 97 | $fileAdder = app(FileAdderFactory::class)->createForPendingMedia($this->model, $pendingMedia); |
| 98 | 98 | |
| 99 | - if (! is_null($this->processCustomProperties)) { |
|
| 99 | + if (!is_null($this->processCustomProperties)) { |
|
| 100 | 100 | $fileAdder->withCustomProperties($pendingMedia->getCustomProperties($this->processCustomProperties)); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if (! is_null($this->customHeaders)) { |
|
| 103 | + if (!is_null($this->customHeaders)) { |
|
| 104 | 104 | $fileAdder = $fileAdder->addCustomHeaders($this->customHeaders); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if (! is_null($pendingMedia->fileName)) { |
|
| 107 | + if (!is_null($pendingMedia->fileName)) { |
|
| 108 | 108 | $fileAdder->setFileName($pendingMedia->fileName); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -9,17 +9,17 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | public function getPath(Media $media): string |
| 11 | 11 | { |
| 12 | - return $this->getBasePath($media). '/' . md5($media->id . $media->uuid . 'original') . '/'; |
|
| 12 | + return $this->getBasePath($media).'/'.md5($media->id.$media->uuid.'original').'/'; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function getPathForConversions(Media $media): string |
| 16 | 16 | { |
| 17 | - return $this->getBasePath($media). '/' . md5($media->id . $media->uuid . 'conversion'); |
|
| 17 | + return $this->getBasePath($media).'/'.md5($media->id.$media->uuid.'conversion'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function getPathForResponsiveImages(Media $media): string |
| 21 | 21 | { |
| 22 | - return $this->getBasePath($media). '/' . md5($media->id . $media->uuid . 'responsive'); |
|
| 22 | + return $this->getBasePath($media).'/'.md5($media->id.$media->uuid.'responsive'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /* |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $prefix = config('media-library.prefix', ''); |
| 31 | 31 | |
| 32 | - $key = md5($media->uuid . $media->getKey()); |
|
| 32 | + $key = md5($media->uuid.$media->getKey()); |
|
| 33 | 33 | |
| 34 | 34 | if ($prefix !== '') { |
| 35 | - return $prefix . '/' . $key; |
|
| 35 | + return $prefix.'/'.$key; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $key; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | public function boot() |
| 25 | 25 | { |
| 26 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'media-library'); |
|
| 27 | - $this->loadTranslationsFrom(__DIR__ . '/../resources/lang/', 'media-library'); |
|
| 28 | - $this->loadJsonTranslationsFrom(__DIR__ . '/../resources/lang/'); |
|
| 26 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'media-library'); |
|
| 27 | + $this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'media-library'); |
|
| 28 | + $this->loadJsonTranslationsFrom(__DIR__.'/../resources/lang/'); |
|
| 29 | 29 | |
| 30 | 30 | $this |
| 31 | 31 | ->registerPublishables() |
@@ -46,18 +46,18 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | protected function registerPublishables(): self |
| 48 | 48 | { |
| 49 | - if (! class_exists('CreateTemporaryUploadsTable')) { |
|
| 49 | + if (!class_exists('CreateTemporaryUploadsTable')) { |
|
| 50 | 50 | $this->publishes([ |
| 51 | - __DIR__ . '/../database/migrations/create_temporary_uploads_table.stub' => database_path('migrations/' . date('Y_m_d_His', time()) . '_create_temporary_uploads_table.php'), |
|
| 51 | + __DIR__.'/../database/migrations/create_temporary_uploads_table.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_temporary_uploads_table.php'), |
|
| 52 | 52 | ], 'media-library-pro-migrations'); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $this->publishes([ |
| 56 | - __DIR__ . '/../resources/views' => base_path('resources/views/vendor/media-library'), |
|
| 56 | + __DIR__.'/../resources/views' => base_path('resources/views/vendor/media-library'), |
|
| 57 | 57 | ], 'media-library-pro-views'); |
| 58 | 58 | |
| 59 | 59 | $this->publishes([ |
| 60 | - __DIR__ . '/../resources/lang' => "{$this->app['path.lang']}/vendor/media-library", |
|
| 60 | + __DIR__.'/../resources/lang' => "{$this->app['path.lang']}/vendor/media-library", |
|
| 61 | 61 | ], 'media-library-pro-lang'); |
| 62 | 62 | |
| 63 | 63 | return $this; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function registerLivewireComponents(): self |
| 77 | 77 | { |
| 78 | - if (! class_exists(Livewire::class)) { |
|
| 78 | + if (!class_exists(Livewire::class)) { |
|
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -87,23 +87,23 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function registerRouteMacros(): self |
| 89 | 89 | { |
| 90 | - RateLimiter::for('medialibrary-pro-uploads', function (Request $request) { |
|
| 90 | + RateLimiter::for ('medialibrary-pro-uploads', function(Request $request) { |
|
| 91 | 91 | return [ |
| 92 | 92 | Limit::perMinute(10)->by($request->ip()), |
| 93 | 93 | ]; |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | - Route::macro('mediaLibrary', function (string $baseUrl = 'media-library-pro') { |
|
| 97 | - Route::prefix($baseUrl)->group(function () { |
|
| 96 | + Route::macro('mediaLibrary', function(string $baseUrl = 'media-library-pro') { |
|
| 97 | + Route::prefix($baseUrl)->group(function() { |
|
| 98 | 98 | if (config('media-library.enable_vapor_uploads')) { |
| 99 | - Route::post("post-s3", '\\' . MediaLibraryPostS3Controller::class) |
|
| 99 | + Route::post("post-s3", '\\'.MediaLibraryPostS3Controller::class) |
|
| 100 | 100 | ->name('media-library-post-s3') |
| 101 | 101 | ->middleware(['throttle:medialibrary-pro-uploads']); |
| 102 | 102 | |
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - Route::post("uploads", '\\' . MediaLibraryUploadController::class) |
|
| 106 | + Route::post("uploads", '\\'.MediaLibraryUploadController::class) |
|
| 107 | 107 | ->name('media-library-uploads') |
| 108 | 108 | ->middleware(['throttle:medialibrary-pro-uploads']); |
| 109 | 109 | }); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $configuredValues = config('media-library.custom_path_generators', []); |
| 118 | 118 | |
| 119 | - if (! array_key_exists(TemporaryUpload::class, $configuredValues)) { |
|
| 119 | + if (!array_key_exists(TemporaryUpload::class, $configuredValues)) { |
|
| 120 | 120 | $configuredValues[TemporaryUpload::class] = TemporaryUploadPathGenerator::class; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | return old($name) ? old($name) : $model |
| 13 | 13 | ->getMedia($collection) |
| 14 | - ->map(function (Media $media) { |
|
| 14 | + ->map(function(Media $media) { |
|
| 15 | 15 | return [ |
| 16 | 16 | 'name' => $media->name, |
| 17 | 17 | 'fileName' => $media->file_name, |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $this |
| 43 | 43 | ->existingMediaLibraryRequestItems() |
| 44 | - ->each(function (MediaLibraryRequestItem $mediaResponseItem) { |
|
| 44 | + ->each(function(MediaLibraryRequestItem $mediaResponseItem) { |
|
| 45 | 45 | $this->handleExistingMediaLibraryRequestItem($mediaResponseItem); |
| 46 | 46 | }); |
| 47 | 47 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | return $this |
| 65 | 65 | ->newMediaLibraryRequestItems() |
| 66 | - ->map(function (MediaLibraryRequestItem $item) { |
|
| 66 | + ->map(function(MediaLibraryRequestItem $item) { |
|
| 67 | 67 | return new PendingMediaItem( |
| 68 | 68 | $item->uuid, |
| 69 | 69 | $item->name, |