Skip to content

Instantly share code, notes, and snippets.

@mseptiaan
Created January 6, 2022 16:27
Show Gist options
  • Save mseptiaan/c4cd1c713b3a4aca80c1fc32e448c212 to your computer and use it in GitHub Desktop.
Save mseptiaan/c4cd1c713b3a4aca80c1fc32e448c212 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