1 | <?php |
||
2 | namespace UniSharp\Uploadable; |
||
3 | |||
4 | use Illuminate\Support\Facades\Route; |
||
5 | |||
6 | class UploaderManager |
||
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
![]() |
|||
7 | { |
||
8 | public static function route($enable = ['store', 'delete'], callable $callback = null): void |
||
9 | { |
||
10 | Route::prefix('files')->group(function () use ($enable, $callback) { |
||
11 | $namespace = '\\UniSharp\\Uploadable\\Http\\Controllers\\Api\\V1\\'; |
||
12 | |||
13 | if (in_array('store', $enable)) { |
||
14 | Route::post('/', $namespace . 'UploadController@store'); |
||
15 | } |
||
16 | |||
17 | if (in_array('delete', $enable)) { |
||
18 | Route::delete('{file}', $namespace . 'UploadController@destroy'); |
||
19 | } |
||
20 | |||
21 | if ($callback) { |
||
22 | $callback(); |
||
23 | } |
||
24 | }); |
||
25 | } |
||
26 | } |
||
27 |