Created
October 4, 2018 10:14
-
-
Save mishazapl/b53b12bcadd2f57026d9165aea1828a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: mihail | |
* Date: 9/3/18 | |
* Time: 3:44 PM | |
*/ | |
namespace App\Services\Price; | |
use App\Services\Contracts\Filters; | |
use \Illuminate\Database\Eloquent\Builder; | |
class PriceFilters implements Filters | |
{ | |
private $builder; | |
public function setBuilder(Builder $builder): PriceFilters | |
{ | |
$this->builder = $builder; | |
return $this; | |
} | |
public function setFilterProvider(): PriceFilters | |
{ | |
if (request()->has('provider_id')) { | |
$this->builder = $this->builder->where('provider_id', request()->input('provider_id')); | |
} | |
return $this; | |
} | |
public function setFilterStatus(): PriceFilters | |
{ | |
$this->builder = $this->builder->where('status', | |
(int)(boolean) request()->input('status', true)); | |
return $this; | |
} | |
public function getBuilder(): Builder | |
{ | |
return $this->builder; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment