mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 12:34:03 +00:00
34 lines
723 B
PHP
34 lines
723 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Contacts\Services;
|
|
|
|
|
|
use App\Models\Contact;
|
|
use App\Http\Resources\Contact as ContactResource;
|
|
|
|
class ListsContact
|
|
{
|
|
|
|
/** @var Contact */
|
|
private $repository;
|
|
|
|
/**
|
|
* ListsContact constructor.
|
|
* @param Contact $repository
|
|
*/
|
|
public function __construct(Contact $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
public function execute(int $type, int $referenceId){
|
|
|
|
$contacts = $this->repository->where('type', $type)
|
|
->where('reference_id', $referenceId)->orderBy('created_at')->paginate(5);
|
|
|
|
// Return collection of contacts as a resource
|
|
return ContactResource::collection($contacts);
|
|
}
|
|
|
|
|
|
} |