mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-21 13:34:13 +00:00
36 lines
652 B
PHP
36 lines
652 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Contacts\Services;
|
|
|
|
|
|
use App\Models\Contact;
|
|
use App\Http\Resources\Contact as ContactResource;
|
|
|
|
class DeletesContact
|
|
{
|
|
/** @var Contact */
|
|
private $repository;
|
|
|
|
/**
|
|
* DeletesContact constructor.
|
|
* @param Contact $repository
|
|
*/
|
|
public function __construct(Contact $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
public function execute(String $id){
|
|
|
|
$contact = $this->repository->findOrFail($id);
|
|
|
|
if($contact->delete()){
|
|
|
|
// Return single address as a resource
|
|
return new ContactResource($contact);
|
|
|
|
}
|
|
}
|
|
|
|
} |