200, 'message' => 'OK', 'data' => $groups ]); } public function store(Request $request) { $this->validate($request, [ 'name' => 'required', 'image' => 'required', 'capacity_number' => 'required|integer', 'total_number' => 'integer|integer', 'expired_at' => 'required|integer', 'state' => 'integer', ]); $group = GroupModel::create($request->all()); return response([ 'code' => 200, 'message' => 'OK', 'data' => $group ]); } public function update(Request $request, $id) { $this->validate($request, [ 'name' => '', 'image' => '', 'capacity_number' => 'integer', 'total_number' => 'integer', 'expired_at' => 'integer', 'state' => 'integer', ]); $group = GroupModel::findOrFail($id); $group->update($request->all()); return response([ 'code' => 200, 'message' => 'Success', 'data' => $group ]); } }