mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
38 lines
737 B
PHP
38 lines
737 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: user
|
|
* Date: 29/04/2019
|
|
* Time: 11:46 AM
|
|
*/
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
|
|
use App\Models\Company;
|
|
use App\Http\Resources\Company as CompanyResource;
|
|
|
|
class ListsCompany
|
|
{
|
|
|
|
/** @var Company */
|
|
private $repository;
|
|
|
|
/**
|
|
* ListsCompany constructor.
|
|
* @param Company $repository
|
|
*/
|
|
public function __construct(Company $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
public function execute(bool $pagination){
|
|
|
|
$companies = $pagination ? $this->repository->orderBy('created_at')->paginate(10) : $this->repository->orderBy('created_at')->get();
|
|
|
|
return CompanyResource::collection($companies);
|
|
|
|
}
|
|
} |