@@ -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, |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function determineListViewName(): string |
35 | 35 | { |
36 | - if (! is_null($this->listView)) { |
|
36 | + if (!is_null($this->listView)) { |
|
37 | 37 | return $this->listView; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function determineItemViewName(): string |
44 | 44 | { |
45 | - if (! is_null($this->itemView)) { |
|
45 | + if (!is_null($this->itemView)) { |
|
46 | 46 | return $this->itemView; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function determineFieldsViewName(): string |
53 | 53 | { |
54 | - if (! is_null($this->fieldsView)) { |
|
54 | + if (!is_null($this->fieldsView)) { |
|
55 | 55 | return $this->fieldsView; |
56 | 56 | } |
57 | 57 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function onFileAdded(array $newMediaItem): void |
73 | 73 | { |
74 | - if (! $this->allowsUpload($newMediaItem)) { |
|
74 | + if (!$this->allowsUpload($newMediaItem)) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function isReplacing(array $newMediaItem): bool |
120 | 120 | { |
121 | - if (! $newMediaItem['oldUuid']) { |
|
121 | + if (!$newMediaItem['oldUuid']) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | public function hideError(string $uuid) |
130 | 130 | { |
131 | - if (! isset($this->media[$uuid])) { |
|
131 | + if (!isset($this->media[$uuid])) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $errors = session()->get('errors'); |
145 | 145 | |
146 | - if (! $errors instanceof ViewErrorBag) { |
|
146 | + if (!$errors instanceof ViewErrorBag) { |
|
147 | 147 | return null; |
148 | 148 | } |
149 | 149 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function onUploadError(string $uuid, string $uploadError) |
159 | 159 | { |
160 | - if (! isset($this->media[$uuid])) { |
|
160 | + if (!isset($this->media[$uuid])) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->multiple = $multiple; |
46 | 46 | |
47 | - $this->uuid = $uuid ?? (string)Str::uuid(); |
|
47 | + $this->uuid = $uuid ?? (string) Str::uuid(); |
|
48 | 48 | |
49 | 49 | $this->add = $add; |
50 | 50 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | { |
54 | 54 | $uploadError = $this->getUploadError(); |
55 | 55 | |
56 | - if (! is_null($uploadError)) { |
|
56 | + if (!is_null($uploadError)) { |
|
57 | 57 | $this->uploadError = $uploadError; |
58 | 58 | |
59 | - if (! $this->add) { |
|
59 | + if (!$this->add) { |
|
60 | 60 | $this->emit("{$this->name}:uploadError", $this->uuid, $uploadError); |
61 | 61 | } |
62 | 62 |
@@ -60,8 +60,8 @@ |
||
60 | 60 | protected function makeSureCustomPropertiesUseRightCasing(array $media): array |
61 | 61 | { |
62 | 62 | $media = collect($media) |
63 | - ->map(function (array $mediaItemAttributes) { |
|
64 | - if (! isset($mediaItemAttributes['custom_properties']) && isset($mediaItemAttributes['customProperties'])) { |
|
63 | + ->map(function(array $mediaItemAttributes) { |
|
64 | + if (!isset($mediaItemAttributes['custom_properties']) && isset($mediaItemAttributes['customProperties'])) { |
|
65 | 65 | $mediaItemAttributes['custom_properties'] = $mediaItemAttributes['customProperties']; |
66 | 66 | unset($mediaItemAttributes['customProperties']); |
67 | 67 | } |