rajakhoury
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 ?

chris10207
chris10207

Did you manage to find a solution by any luck?

zakir2229
zakir2229

any solution, anybody ?

sayaamiruladli51935
sayaamiruladli51935

middleware => ['mymiddleware'] instead of middleware => 'mymiddleware'

daftspunk
daftspunk

What happens with the current code, any errors?

1-5 of 5