$image, 'title' => $data['title'], 'sub_title' => $data['sub_title'], 'description' => $data['description'], 'direction'=> $data['direction'] == true ?1 :0, 'is_have_button'=> $data['is_have_button'] == true ?1 :0 ]); $contact->save(); return []; } public function updateContact(int $id, $data) { $contact = Contact::find($id); if (isset($data['image'])) { $image = ImageService::update_image($data['image'], $contact->image, 'contact'); $data['image'] = $image; } return $this->update($id,$data); } public function delete(int $id) { $contact = Contact::find($id); $contact->delete(); ImageService::delete_image($contact->image); return []; } }