mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-20 04:54:01 +00:00
42 lines
736 B
PHP
42 lines
736 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: user
|
|
* Date: 09/05/2019
|
|
* Time: 11:51 AM
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
}
|
|
|
|
} |