Skip to content

Instantly share code, notes, and snippets.

@mseptiaan
Created January 6, 2022 16:27
Show Gist options
  • Save mseptiaan/13a59d3b8ce1ee2b7c6a13e4c16bbdac to your computer and use it in GitHub Desktop.
Save mseptiaan/13a59d3b8ce1ee2b7c6a13e4c16bbdac to your computer and use it in GitHub Desktop.
description
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment