get(); } public function storeCoop(array $coopData): Coop { return DB::transaction(function () use ($coopData) { $coop = Coop::create($coopData); return $coop; }); } public function getCoopById(int $id) { return Coop::findOrFail($id); } public function updateCoop(int $id, array $coopData) { $coop = $this->getCoopById($id); return DB::transaction(function () use ($coop, $coopData) { $coop->update($coopData); return $coop; }); } public function deleteCoop(int $id) { return DB::transaction(function () use ($id) { $coop = $this->getCoopById($id); $coop->delete(); return true; }); } }