FEATURE #2048: add basics of permissions management
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
Route::pattern('id', '\d+');
|
||||
Route::pattern('url', '[0-9\-a-z]+');
|
||||
|
||||
/*******************************************************************************/
|
||||
Auth::routes();
|
||||
$this->get('logout', 'Auth\LoginController@logout')
|
||||
->name('logout');
|
||||
|
||||
/**
|
||||
* This route group serves to handle request in admin
|
||||
*/
|
||||
|
||||
Route::group([
|
||||
'prefix' => LaravelLocalization::setLocale() . '/admin',
|
||||
'middleware' => ['bindings', 'admin']
|
||||
], function () {
|
||||
|
||||
// include all routes in routes/admin subfolder
|
||||
$files = File::allFiles('routes/admin');
|
||||
foreach ($files as $file) {
|
||||
require_once base_path($file);
|
||||
}
|
||||
|
||||
// display dashboard with some usefull information
|
||||
Route::get('/', 'Dashboard\Dashboard@index')
|
||||
->name('admin.dashboard');
|
||||
|
||||
// list of all actions
|
||||
Route::get('actions', 'ActionLog\Overview@index')
|
||||
->name('log.overview');
|
||||
|
||||
// search form with results
|
||||
Route::get('search', 'Search@getSearch')
|
||||
->name('search');
|
||||
});
|
||||
@@ -6,11 +6,13 @@ Route::group(['namespace' => 'Contents'], function () {
|
||||
|
||||
// form for creating new static page
|
||||
Route::get('content/new/{module}', 'CreateNewContent@create')
|
||||
->name('content.new');
|
||||
->name('content.new')
|
||||
->middleware(['can:create,module', 'can:create,' . \App\Models\Content\Content::class]);
|
||||
|
||||
// form for editing existing static page
|
||||
Route::get('content/edit/{page}', 'EditContent@edit')
|
||||
->name('content.edit');
|
||||
->name('content.edit')
|
||||
->middleware('can:update,page');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/new/{module}', 'CreateNewContent@store')
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
Route::resource('permissions', 'Permissions');
|
||||
+10
-48
@@ -10,55 +10,17 @@ Route::pattern('id', '\d+');
|
||||
Route::pattern('url', '[0-9\-a-z]+');
|
||||
|
||||
/*******************************************************************************/
|
||||
Auth::routes();
|
||||
$this->get('logout', 'Auth\LoginController@logout')->name('logout');
|
||||
|
||||
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['bindings']], function () {
|
||||
/**
|
||||
* This route group serves to handle request in admin
|
||||
*/
|
||||
Route::group([
|
||||
'middleware' => ['admin'],
|
||||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin'
|
||||
], function () {
|
||||
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['bindings', 'web']], function () {
|
||||
// Homepage
|
||||
Route::get('/', 'Visitor\Homepage@getIndex')
|
||||
->name('page.index');
|
||||
|
||||
// include all routes in routes/admin subfolder
|
||||
$files = ['contents', 'fileManager', 'settings', 'templates', 'users', 'widgets'];
|
||||
foreach ($files as $file) {
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . $file . '.php';
|
||||
}
|
||||
// route for sitemap
|
||||
Route::get('sitemap.xml', 'Visitor\Sitemap@getMap')
|
||||
->name('sitemap');
|
||||
|
||||
// display dashboard with some usefull information
|
||||
Route::get('/', 'Dashboard\Dashboard@index')
|
||||
->name('admin.dashboard');
|
||||
|
||||
// list of all actions
|
||||
Route::get('actions', 'ActionLog\Overview@index')
|
||||
->name('log.overview');
|
||||
|
||||
// search form with results
|
||||
Route::get('search', 'Search@getSearch')
|
||||
->name('search');
|
||||
});
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
/**
|
||||
* This section must be specified as last one
|
||||
*/
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
// Homepage
|
||||
Route::get('/', 'Visitor\Homepage@getIndex')
|
||||
->name('page.index');
|
||||
|
||||
// route for sitemap
|
||||
Route::get('sitemap.xml', 'Visitor\Sitemap@getMap')
|
||||
->name('sitemap');
|
||||
|
||||
// route for all content pages. This rule must be specified last (because it matches every route)
|
||||
Route::get('{url}', 'Visitor\ContentPage@getPage')
|
||||
->name('page.content');
|
||||
});
|
||||
// route for all content pages. This rule must be specified last (because it matches every route)
|
||||
Route::get('{url}', 'Visitor\ContentPage@getPage')
|
||||
->name('page.content');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user