@@ -30,8 +30,9 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $location = $request->get('location', '/'); |
| 32 | 32 | |
| 33 | - if ( ! $this->manager->exists($location)) |
|
| 34 | - return static::jsonResponseError(['message' => 'Location not found'], 404); |
|
| 33 | + if ( ! $this->manager->exists($location)) { |
|
| 34 | + return static::jsonResponseError(['message' => 'Location not found'], 404); |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | return static::jsonResponse( |
| 37 | 38 | $this->manager->all($location)->values()->toArray() |
@@ -152,11 +153,9 @@ discard block |
||
| 152 | 153 | |
| 153 | 154 | if ($type === MediaItem::TYPE_FILE){ |
| 154 | 155 | $this->manager->deleteFile($path); |
| 155 | - } |
|
| 156 | - elseif ($type === MediaItem::TYPE_DIRECTORY) { |
|
| 156 | + } elseif ($type === MediaItem::TYPE_DIRECTORY) { |
|
| 157 | 157 | $this->manager->deleteDirectory($path); |
| 158 | - } |
|
| 159 | - else { |
|
| 158 | + } else { |
|
| 160 | 159 | // TODO: Throw an exception ? |
| 161 | 160 | } |
| 162 | 161 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $this->adminGroup(function () { |
| 27 | 27 | $this->prefix('media')->name('media.')->group(function () { |
| 28 | 28 | $this->get('/', [MediaController::class, 'index']) |
| 29 | - ->name('index'); // admin::media.index |
|
| 29 | + ->name('index'); // admin::media.index |
|
| 30 | 30 | |
| 31 | 31 | $this->mapApiRoutes(); |
| 32 | 32 | }); |
@@ -40,28 +40,28 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $this->prefix('api')->name('api.')->middleware(['ajax'])->group(function () { |
| 42 | 42 | $this->get('items', [MediaApiController::class, 'all']) |
| 43 | - ->name('items.index'); // admin::media.api.items.index |
|
| 43 | + ->name('items.index'); // admin::media.api.items.index |
|
| 44 | 44 | |
| 45 | 45 | $this->get('directories', [MediaApiController::class, 'directories']) |
| 46 | - ->name('directories.index'); // admin::media.api.directories.index |
|
| 46 | + ->name('directories.index'); // admin::media.api.directories.index |
|
| 47 | 47 | |
| 48 | 48 | $this->post('upload', [MediaApiController::class, 'upload']) |
| 49 | - ->name('upload'); // admin::media.api.upload |
|
| 49 | + ->name('upload'); // admin::media.api.upload |
|
| 50 | 50 | |
| 51 | 51 | $this->post('new-folder', [MediaApiController::class, 'newFolder']) |
| 52 | - ->name('new-folder'); // admin::media.api.new-folder |
|
| 52 | + ->name('new-folder'); // admin::media.api.new-folder |
|
| 53 | 53 | |
| 54 | 54 | $this->put('move', [MediaApiController::class, 'move']) |
| 55 | - ->name('move'); // admin::media.api.move |
|
| 55 | + ->name('move'); // admin::media.api.move |
|
| 56 | 56 | |
| 57 | 57 | $this->put('rename', [MediaApiController::class, 'rename']) |
| 58 | - ->name('rename'); // admin::media.api.rename |
|
| 58 | + ->name('rename'); // admin::media.api.rename |
|
| 59 | 59 | |
| 60 | 60 | $this->delete('delete', [MediaApiController::class, 'delete']) |
| 61 | - ->name('delete'); // admin::media.api.delete |
|
| 61 | + ->name('delete'); // admin::media.api.delete |
|
| 62 | 62 | |
| 63 | 63 | $this->get('download', [MediaApiController::class, 'download']) |
| 64 | - ->name('download'); // admin::media.api.delete |
|
| 64 | + ->name('download'); // admin::media.api.delete |
|
| 65 | 65 | }); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -160,8 +160,9 @@ |
||
| 160 | 160 | */ |
| 161 | 161 | public function exists($path): bool |
| 162 | 162 | { |
| 163 | - if ($path === '/') |
|
| 164 | - return true; |
|
| 163 | + if ($path === '/') { |
|
| 164 | + return true; |
|
| 165 | + } |
|
| 165 | 166 | |
| 166 | 167 | return $this->disk()->exists($path); |
| 167 | 168 | } |