model->all(); } public function find(int $id): ?Country { return $this->model->find($id); } public function create(CountryDTO $dto): Country { return $this->model->create($dto->toArray()); } public function update(int $id, CountryDTO $dto, array $fieldsToUpdate): Country { $record = $this->find($id); $updateFields = array_intersect_key( $dto->toArray(), array_flip($fieldsToUpdate) ); $record->update($updateFields); return $record->fresh(); } public function delete(int $id): bool { return $this->model->destroy($id) > 0; } }