Skip to content

Commit 71e9e09

Browse files
committed
Return JSONResponse instead of array from performSaveAction
1 parent ccfeea9 commit 71e9e09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/app/Http/Controllers/Operations/UpdateOperation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function edit($id)
8282
/**
8383
* Update the specified resource in the database.
8484
*
85-
* @return array|\Illuminate\Http\RedirectResponse
85+
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
8686
*/
8787
public function update()
8888
{

src/app/Library/CrudPanel/Traits/SaveActions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public function setSaveAction($forceSaveAction = null)
321321
* Redirect to the correct URL, depending on which save action has been selected.
322322
*
323323
* @param string $itemId
324-
* @return array|\Illuminate\Http\RedirectResponse
324+
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
325325
*/
326326
public function performSaveAction($itemId = null)
327327
{
@@ -345,12 +345,12 @@ public function performSaveAction($itemId = null)
345345

346346
// if the request is AJAX, return a JSON response
347347
if ($this->getRequest()->ajax()) {
348-
return [
348+
return response()->json([
349349
'success' => true,
350350
'data' => $this->entry,
351351
'redirect_url' => $redirectUrl,
352352
'referrer_url' => $referrer_url ?? false,
353-
];
353+
]);
354354
}
355355

356356
if (isset($referrer_url)) {

0 commit comments

Comments
 (0)