|
@@ -18,7 +18,7 @@ class Authenticate
|
|
public function handle($request, Closure $next, $guard = null)
|
|
public function handle($request, Closure $next, $guard = null)
|
|
{
|
|
{
|
|
if (Auth::guard($guard)->guest()) {
|
|
if (Auth::guard($guard)->guest()) {
|
|
- if ($request->ajax()) {
|
|
|
|
|
|
+ if ($request->ajax() || $request->wantsJson()) {
|
|
return response('Unauthorized.', 401);
|
|
return response('Unauthorized.', 401);
|
|
} else {
|
|
} else {
|
|
return redirect()->guest('login');
|
|
return redirect()->guest('login');
|