fix loading all pages

This commit is contained in:
arifal
2025-02-12 01:53:40 +07:00
parent 1a15bc03f8
commit b4b34b503e
22 changed files with 784 additions and 166 deletions

View File

@@ -47,13 +47,11 @@ class MenusController extends Controller
'sort_order' => $request->sort_order,
]);
DB::commit();
return redirect()->route('menus.index')->with('success','Success created menu');
return response()->json(['message' => 'Successfully created'], 200);
}catch(\Exception $e){
DB::rollBack();
\Log::error('Menu creation failed: ' . $e->getMessage()); // Log the error for debugging
return redirect()->back()
->withInput()
->withErrors('Something went wrong! Please try again.');
return response()->json(['message'=> $e->getMessage()],500);
}
}
@@ -95,13 +93,11 @@ class MenusController extends Controller
DB::beginTransaction();
$menu->update($validateData);
DB::commit();
return redirect()->route('menus.index')->with('success','Successfully updated');
return response()->json(['message' => 'Successfully updated'], 200);
}catch(\Exception $e){
DB::rollBack();
\Log::error('Menu update failed: '. $e->getMessage()); // Log the error for debugging
return redirect()->back()
->withInput()
->withErrors('Something went wrong! Please try again.');
return response()->json(['message' => $e->getMessage()],500);
}
}