view src/Database/Builder.php @ 7:e6132a1e8e24 default tip

Adding better support for test among other base changes.
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 25 Sep 2025 19:58:32 -0400
parents b44434aaa767
children
line wrap: on
line source

<?php

namespace Wizard\Framework\Database;

use Illuminate\Database\Eloquent\Builder as BaseBuilder;

class Builder extends BaseBuilder {
	
	public $named_joins = [];

	/*
	 * Add's a named join to the query, this will only add the joins
	 * a single time, and keep track of joins that are already in the query.
	 *
	 */
	public function addNamedJoin($join = '') {
		$available_joins = $this->model?->named_joins() ?? [];
		if(isset($available_joins[$join]) && ($named_joins[$join] ?? false) == false) {
			$this->named_joins[$join] = true;
			$available_joins[$join]($this);
		}
	}
}