Private
Public Access
1
0
Files
Virtnet.bond/vendor/kirschbaum-development/eloquent-power-joins/src/StaticCache.php
2026-03-12 22:47:38 +01:00

31 lines
704 B
PHP

<?php
namespace Kirschbaum\PowerJoins;
use Illuminate\Database\Eloquent\Model;
class StaticCache
{
/**
* Cache to not join the same relationship twice.
*
* @var array<int, string>
*/
public static array $powerJoinAliasesCache = [];
public static function getTableOrAliasForModel(Model $model): string
{
return static::$powerJoinAliasesCache[spl_object_id($model)] ?? $model->getTable();
}
public static function setTableAliasForModel(Model $model, $alias): void
{
static::$powerJoinAliasesCache[spl_object_id($model)] = $alias;
}
public static function clear(): void
{
static::$powerJoinAliasesCache = [];
}
}