Document transaction listener add isAjax control..
This commit is contained in:
parent
f1072f348f
commit
10673c6be9
@ -36,16 +36,30 @@ class CreateDocumentTransaction
|
|||||||
if (empty($user) || $signed) {
|
if (empty($user) || $signed) {
|
||||||
flash($message)->error()->important();
|
flash($message)->error()->important();
|
||||||
|
|
||||||
redirect()->route("signed.$type.show", $document->id)->send();
|
return $this->getResponse('signed.' . $type . '.show', $document, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->can('read-client-portal')) {
|
if ($user->can('read-client-portal')) {
|
||||||
flash($message)->error()->important();
|
flash($message)->error()->important();
|
||||||
|
|
||||||
redirect()->route("portal.$type.show", $document->id)->send();
|
return $this->getResponse('portal.' . $type . '.show', $document, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \Exception($message);
|
throw new \Exception($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getResponse($path, $document, $message)
|
||||||
|
{
|
||||||
|
if (request()->expectsJson()) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'errors' => true,
|
||||||
|
'message' => $message,
|
||||||
|
'redirect' => route($path, $document->id)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route($path, $document->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user