- if (request()->wantsJson()) {
- $response = response()->json(['error' => trans('errors.permissionJson')], 403);
- } else {
- $response = redirect('/');
- $this->showErrorNotification(trans('errors.permission'));
- }
-
- throw new HttpResponseException($response);
+ $message = request()->wantsJson() ? trans('errors.permissionJson') : trans('errors.permission');
+ throw new NotifyException($message, '/', 403);