*/ protected $dontFlash = [ 'current_password', 'password', 'password_confirmation', ]; /** * Register the exception handling callbacks for the application. */ public function register(): void { $this->reportable(function (Throwable $e) { // }); } protected function unauthenticated($request, AuthenticationException $exception): Response { if ($request instanceof Request && ($request->is('api/*') || $request->expectsJson())) { return new JsonResponse(['message' => 'Unauthenticated.'], 401); } return parent::unauthenticated($request, $exception); } }