ajout middleware auth
This commit is contained in:
parent
71a89a5a05
commit
480a27897e
|
@ -11,6 +11,7 @@ return [
|
|||
'custom' => \Meoran\Images\Templates\Custom::class,
|
||||
|
||||
),
|
||||
'middlewareAuth' => false,
|
||||
'lifetime' => 10,
|
||||
'cache' => [
|
||||
'path' => storage_path('app')
|
||||
|
|
|
@ -46,9 +46,14 @@ class ImagesServiceProvider extends ServiceProvider
|
|||
$this->app->router->group([
|
||||
'namespace' => '\Meoran\Images\Http\Controllers',
|
||||
], function ($router) {
|
||||
$addAuthMiddleware = config('middlewareAuth', false);
|
||||
$authMiddleware = [];
|
||||
if ($addAuthMiddleware) {
|
||||
$authMiddleware = ['middleware' => 'auth'];
|
||||
}
|
||||
$router->post('images/upload', [
|
||||
'as' => 'uploadImage', 'uses' => 'ImagesController@upload'
|
||||
]);
|
||||
]+$authMiddleware);
|
||||
|
||||
$router->get('images/{filename}', [
|
||||
'as' => 'getPicture', 'uses' => 'ImagesController@get'
|
||||
|
@ -56,7 +61,7 @@ class ImagesServiceProvider extends ServiceProvider
|
|||
|
||||
$router->delete('images/{id}', [
|
||||
'as' => 'deletePicture', 'uses' => 'ImagesController@delete'
|
||||
]);
|
||||
]+$authMiddleware);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue