Fixes for live preview

This commit is contained in:
David Bomba 2021-07-27 22:20:32 +10:00
parent 284203401b
commit f644a2b460
2 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ class Handler extends ExceptionHandler
} elseif ($exception instanceof NotFoundHttpException && $request->expectsJson()) {
return response()->json(['message'=>'Route does not exist'], 404);
} elseif ($exception instanceof MethodNotAllowedHttpException && $request->expectsJson()) {
return response()->json(['message'=>'Method not support for this route'], 404);
return response()->json(['message'=>'Method not supported for this route'], 404);
} elseif ($exception instanceof ValidationException && $request->expectsJson()) {
nlog($exception->validator->getMessageBag());
return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422);

View File

@ -191,7 +191,7 @@ class PreviewController extends BaseController
if($request->has('entity_id')){
$entity_obj = $class::whereId($this->decodePrimaryKey($request->input('entity_id')))->company()->first();
$entity_obj = $class::withTrashed()->whereId($this->decodePrimaryKey($request->input('entity_id')))->company()->first();
$entity_obj = $repo->save($request->all(), $entity_obj);
}