mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-25 23:43:56 +00:00
34 lines
733 B
PHP
34 lines
733 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
|
|
use App\Models\Company;
|
|
use App\Http\Resources\Company as CompanyResource;
|
|
use Illuminate\Http\Request;
|
|
|
|
class SearchesCompany
|
|
{
|
|
|
|
/** @var Company */
|
|
private $repository;
|
|
|
|
/**
|
|
* SearchesCompany constructor.
|
|
* @param Company $repository
|
|
*/
|
|
public function __construct(Company $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
public function execute(Request $request){
|
|
|
|
$companies = $this->repository->where('name', 'LIKE', "%".$request->input('query')."%")
|
|
->orWhere('marking', 'LIKE', "%".$request->input('query')."%")->paginate(10);
|
|
|
|
return CompanyResource::collection($companies);
|
|
}
|
|
|
|
} |