/** * Get the response for a forbidden operation. * * @param array $errors * @return \Symfony\Component\HttpFoundation\Response */ public function response(array $errors) { $redirectURL = $this->getRedirectUrl(); if ($this->ban) { return redirect($this->ban->getRedirectUrl()); } return redirect($redirectURL)->withInput($this->except($this->dontFlash))->withErrors($errors, $this->errorBag); }
/** * Returns the response if authorize() fails. * * @return Response */ public function forbiddenResponse() { if ($this->ban) { $url = $this->ban->getRedirectUrl(); if ($this->wantsJson()) { return response()->json(['redirect' => $url]); } else { return redirect($url); } } return abort(403); }