Skip to content

Commit dbeb175

Browse files
authored
Merge pull request #63 from jd-dotlogics/bugfix/add_middlewares_to_config
Protected the routes with middlewares and added middleware option in …
2 parents fe3b30b + c222332 commit dbeb175

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

src/config.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
'force_class' => false,
77
'fonts' => [],
88
'styles' => [],
9-
'scripts' => []
9+
'scripts' => [],
10+
'middleware' => [
11+
'web', 'auth'
12+
],
1013
];

src/routes/grapesjs.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
use Illuminate\Support\Facades\Route;
44

55

6-
Route::prefix('grapesjs')->name('grapesjs.')->namespace('Dotlogics\Grapesjs\App\Http\Controllers')->group(function(){
7-
Route::post('editor/asset/store', 'AssetController@store')->name('editor.asset.store');
8-
9-
Route::get('editor/{model}/{editable}', 'EditorController@editor')->name('editor.model.editor');
10-
Route::post('editor/{model}/{editable}', 'EditorController@store')->name('editor.model.store');
11-
12-
Route::get('editor/{model}/{editable}/templates', 'EditorController@templates')->name('editor.model.templates');
13-
Route::get('editor/templates', 'EditorController@templates')->name('editor.templates');
14-
});
6+
Route::prefix('grapesjs')
7+
->name('grapesjs.')
8+
->namespace('Dotlogics\Grapesjs\App\Http\Controllers')
9+
->middleware(config('grapesjs.middleware', []))
10+
->group(function(){
11+
Route::post('editor/asset/store', 'AssetController@store')->name('editor.asset.store');
12+
13+
Route::get('editor/{model}/{editable}', 'EditorController@editor')->name('editor.model.editor');
14+
Route::post('editor/{model}/{editable}', 'EditorController@store')->name('editor.model.store');
15+
16+
Route::get('editor/{model}/{editable}/templates', 'EditorController@templates')->name('editor.model.templates');
17+
Route::get('editor/templates', 'EditorController@templates')->name('editor.templates');
18+
});

0 commit comments

Comments
 (0)