Prepare modules

This commit is contained in:
2025-03-22 12:44:30 -06:00
parent 099267ee07
commit 7d8566350d
137 changed files with 3723 additions and 4325 deletions

View File

@ -27,19 +27,24 @@ abstract class BootstrapTableQueryBuilder
foreach ($this->config['joins'] as $join) {
$type = $join['type'] ?? 'join';
$this->query->{$type}($join['table'], function($joinObj) use ($join) {
$joinObj->on($join['first'], '=', $join['second']);
// Soporte para alias
$table = $join['table'];
$alias = $join['alias'] ?? null;
$tableWithAlias = $alias ? DB::raw("{$table} as {$alias}") : $table;
// Soporte para AND en ON, si está definidio
$this->query->{$type}($tableWithAlias, function ($joinObj) use ($join, $alias) {
$first = $join['first'];
$second = $join['second'];
$joinObj->on($first, '=', $second);
// Soporte para condiciones adicionales tipo AND
if (!empty($join['and'])) {
foreach ((array) $join['and'] as $andCondition) {
// 'sat_codigo_postal.c_estado = sat_localidad.c_estado'
$parts = explode('=', $andCondition);
if (count($parts) === 2) {
$left = trim($parts[0]);
$right = trim($parts[1]);
$joinObj->whereRaw("$left = $right");
}
}