cleaniquecoders /
blueprint-macro
| 1 | <?php |
||
| 2 | |||
| 3 | use Illuminate\Database\Eloquent\Builder; |
||
| 4 | |||
| 5 | Builder::macro('status', function ($status, $key = 'status') { |
||
| 6 | return $this->where($key, $status); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 7 | }); |
||
| 8 | |||
| 9 | Builder::macro('is', function ($key, $value = true, $prefix = 'is_') { |
||
| 10 | return $this->where($prefix.$key, $value); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 11 | }); |
||
| 12 | |||
| 13 | Builder::macro('at', function ($key, $value, $suffix = '_at') { |
||
| 14 | return $this->where($key.$suffix, $value); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 15 | }); |
||
| 16 | |||
| 17 | Builder::macro('by', function ($key, $value, $suffix = '_by') { |
||
| 18 | return $this->where($key.$suffix, $value); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 19 | }); |
||
| 20 |