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

@@ -53,10 +53,10 @@ class UsersController extends Controller
$user->roles()->attach($request->role_id);
DB::commit();
return redirect()->route('users.index')->with('success','Successfully registered');
return response()->json(['message' => 'Successfully created'],201);
}catch(\Exception $e){
DB::rollBack();
return redirect()->back()->with("error", $e->getMessage());
return response()->json(['message' => $e->getMessage()],500);
};
}
public function show($id){
@@ -90,10 +90,10 @@ class UsersController extends Controller
$user->update($updateData);
$user->roles()->sync([$request->role_id]);
DB::commit();
return redirect()->route('users.index')->with('success', 'Successfully');
return response()->json(['message' => 'Successfully updated'],200);
}catch(\Exception $e){
DB::rollBack();
return redirect()->back()->with("error", $e->getMessage());
return response()->json(['message' => $e->getMessage()],500);
}
}
public function destroy($id){