public $redirectLocation;
protected $status;
- /**
- * NotifyException constructor.
- */
public function __construct(string $message, string $redirectLocation = '/', int $status = 500)
{
$this->message = $message;
{
$message = $this->getMessage();
+ // Front-end JSON handling. API-side handling managed via handler.
+ if ($request->wantsJson()) {
+ return response()->json(['error' => $message], 403);
+ }
+
if (!empty($message)) {
session()->flash('error', $message);
}