0, 'msg' => $this->getMessage(), ]; if ($request->ajax()) { return $output; } else { throw new Exception($this->getMessage()); } } }