name($name); } public static function make(string $name): static { $static = app(static::class, ['name' => $name]); $static->configure(); return $static; } public function getTable(): Table { return $this->table ?? $this->getGroup()?->getTable() ?? $this->getLayout()?->getTable() ?? throw new Exception("The column [{$this->getName()}] is not mounted to a table."); } /** * @return array */ protected function resolveDefaultClosureDependencyForEvaluationByName(string $parameterName): array { return match ($parameterName) { 'livewire' => [$this->getLivewire()], 'record' => [$this->getRecord()], 'rowLoop' => [$this->getRowLoop()], 'state' => [$this->getState()], 'table' => [$this->getTable()], default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName), }; } /** * @return array */ protected function resolveDefaultClosureDependencyForEvaluationByType(string $parameterType): array { $record = $this->getRecord(); if (! $record) { return parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType); } return match ($parameterType) { Model::class, $record::class => [$record], default => parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType), }; } }