signifly /
laravel-builder-macros
| 1 | <?php |
||
| 2 | |||
| 3 | use Illuminate\Database\Eloquent\Builder; |
||
| 4 | |||
| 5 | Builder::macro('leftJoinRelation', function (string $relationName, $operator = '=') { |
||
| 6 | $relation = $this->getRelation($relationName); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 7 | |||
| 8 | return $this->leftJoin( |
||
| 9 | $relation->getRelated()->getTable(), |
||
| 10 | $relation->getQualifiedForeignKeyName(), |
||
| 11 | $operator, |
||
| 12 | $relation->getQualifiedParentKeyName() |
||
| 13 | ); |
||
| 14 | }); |
||
| 15 |