mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
40 lines
806 B
PHP
40 lines
806 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: user
|
|
* Date: 06/03/2019
|
|
* Time: 4:57 PM
|
|
*/
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
} |