We are developing a laravel application, the application has an administrative part, accessible only to admin users in the routes
file:
Route::group(['middleware' => 'admin', 'prefix' => 'admin', 'namespace'
=> 'Admin'] , function() {
Route::get('oldAdminUrl', 'oldControllwe@handle');
}
The file descriptor function is middleware
similar to
public function handle($request, Closure $next)
{
if ($this->admin->guest())
{
}
return $next($request);
}
ad $this->Admin
refers to Model
called adminModel
with the following attribute
protected $table = 'admin'
Now we need to add a new URL to the admin URL group, to name it newAdminUrl
it should be available for both admin
users and a new user group by calling themeditors
URL- admin group
middleware
, editorsMiddleware
admin middleware
, , , newAdminUrl
, ,
Route::group(['middleware' => ['admin','editors], 'prefix' => 'admin',
'namespace' => 'Admin'] , function() {
Route::get('newAdminUrl', 'newControllwe@handle');
}
EditorModel
, editorMiddleware
, :
protected $table = 'editor'
:
? - ?