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