I have questions about Multi-Auth of Laraship.
I'd like admin users to access https://domain/admin/ area only.
URLs are https://domain/admin/login and
https://domain/admin/dashboard etc.
1)The modules and core have each web.php file.
Do I need to code below line manually at each web.php file?
Route::group(['prefix' => 'admin', 'middleware' => 'auth:admin'], function() {
}
2)About Middleware setting, is it good to have files just in app/Http/Middleware folder?
3)When I do admin's Multi-Auth at Laraship, which is better
to use Multi-Auth package (e.g. https://github.com/Hesto/multi-auth )
or to code manually?
Hello,
1) The Standard and recommended way is to do it through roles and permissions management you have and create a new permission to dashboard access.
Then assign this to a role you customize all it admin for example and then add to the dashboard controller
if (!user()->hasPermissionTo('User::dashboard.access')) {
abort(403);
}
2) Check PaymentServiceProvider in how to register middlewares dynamically.
public function register()
{
$this->app['router']->pushMiddlewareToGroup('web', \Torann\Currency\Middleware\CurrencyMiddleware::class);
}
3) This Relies on your business and requirement and how much the package provided
Please login or Register to submit your answer