cleaniquecoders /
blueprint-macro
| 1 | <?php |
||
| 2 | |||
| 3 | use Illuminate\Database\Eloquent\Builder; |
||
| 4 | |||
| 5 | Builder::macro('uuid', function ($uuid) { |
||
| 6 | return $this->where('uuid', $uuid); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 7 | }); |
||
| 8 | |||
| 9 | Builder::macro('findByUuid', function ($uuid) { |
||
| 10 | return $this->uuid($uuid)->firstOrFail(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 11 | }); |
||
| 12 | |||
| 13 | Builder::macro('hashslug', function ($hashslug) { |
||
| 14 | return $this->where('hashslug', $hashslug); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 15 | }); |
||
| 16 | |||
| 17 | Builder::macro('findByHashSlug', function ($hashslug) { |
||
| 18 | return $this->hashslug($hashslug)->firstOrFail(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 19 | }); |
||
| 20 | |||
| 21 | Builder::macro('hashslugOrId', function ($identifier) { |
||
| 22 | return $this->hashslug($identifier)->orWhere('id', $identifier); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 23 | }); |
||
| 24 | |||
| 25 | Builder::macro('findByHashSlugOrId', function ($identifier) { |
||
| 26 | return $this->hashslugOrId($identifier)->firstOrFail(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 27 | }); |
||
| 28 | |||
| 29 | Builder::macro('slug', function ($slug) { |
||
| 30 | return $this->where('slug', $slug); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 31 | }); |
||
| 32 | |||
| 33 | Builder::macro('findBySlug', function ($slug) { |
||
| 34 | return $this->slug($slug)->firstOrFail(); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 35 | }); |
||
| 36 |