Mercurial > packages > framework
comparison src/Database/Builder.php @ 2:b44434aaa767
Moving around the components.
Made a big step in the right direction with the Builder and named joins being accessible.
| author | luka |
|---|---|
| date | Wed, 18 Jun 2025 22:28:47 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:56d9c64d64aa | 2:b44434aaa767 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 namespace Wizard\Framework\Database; | |
| 4 | |
| 5 use Illuminate\Database\Eloquent\Builder as BaseBuilder; | |
| 6 | |
| 7 class Builder extends BaseBuilder { | |
| 8 | |
| 9 public $named_joins = []; | |
| 10 | |
| 11 /* | |
| 12 * Add's a named join to the query, this will only add the joins | |
| 13 * a single time, and keep track of joins that are already in the query. | |
| 14 * | |
| 15 */ | |
| 16 public function addNamedJoin($join = '') { | |
| 17 $available_joins = $this->model?->named_joins() ?? []; | |
| 18 if(isset($available_joins[$join]) && ($named_joins[$join] ?? false) == false) { | |
| 19 $this->named_joins[$join] = true; | |
| 20 $available_joins[$join]($this); | |
| 21 } | |
| 22 } | |
| 23 } |
