This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
rajakhoury
Hi,
This is maybe a general Laravel question but I'm having a hard time making the Auth middle-ware return request to components
Routes.php
Route::group([ 'prefix' => 'client' ,'middleware' => 'RainLab\User\Classes\AuthMiddleware'], function () {
Route::any('profile', function () {
// If user is logged in pass the request to the component
});
});
AuthMiddleware
class AuthMiddleware
{
public function handle($request, Closure $next)
{
if (!Auth::check()) {
return Response::make( "Access Denied" , 403);
}
return $next($request);
}
}
I would like to avoid adding if (!Auth::check())
in all components, ajax calls ect and do it from one place for all these routes.
Any idea ?
1-5 of 5