There is Laravel Middleware, which should redirect if the user is not logged in with the next. content:
public function handle($request, Closure $next) { if (Auth::guest()) { redirect('/login'); } return $next($request); } And the route:
Route::get('/solditems', ['middleware' => 'unauthorised', function(){}], 'PostController@sold'); But middleware does not work and instead of redirection, I get to where the route leads. What is the problem?
$routeMiddleware? - maxkrasnov$routeMiddlewarespelled'unauthorised' => Middleware\IfUnAuthorized::class,- RedScreed