Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
4 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| RequestDevolutionQueryBuilder | |
50.00% |
4 / 8 |
|
0.00% |
0 / 1 |
4.12 | |
0.00% |
0 / 1 |
| search | |
50.00% |
4 / 8 |
|
0.00% |
0 / 1 |
4.12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Request\QueryBuilders; |
| 4 | |
| 5 | |
| 6 | use Domain\Request\DTOs\RequestDevolutionSearchDTO; |
| 7 | use Illuminate\Database\Eloquent\Builder; |
| 8 | |
| 9 | class RequestDevolutionQueryBuilder extends Builder |
| 10 | { |
| 11 | |
| 12 | public function search(RequestDevolutionSearchDTO $requestDevolutionSearchDTO) |
| 13 | { |
| 14 | if ($requestDevolutionSearchDTO->stock_io_id) { |
| 15 | $this->whereHas('stockIOProduct', function ($builder) use ($requestDevolutionSearchDTO) { |
| 16 | $builder->join('stock_ios', 'stock_io_products.stock_io_id', '=', 'stock_ios.id') |
| 17 | ->where('stock_ios.id', $requestDevolutionSearchDTO->stock_io_id); |
| 18 | }); |
| 19 | } |
| 20 | |
| 21 | if ($requestDevolutionSearchDTO->stock_io_product_id) { |
| 22 | $this->where('stock_io_product_id', $requestDevolutionSearchDTO->stock_io_product_id); |
| 23 | } |
| 24 | |
| 25 | return $this; |
| 26 | } |
| 27 | } |