This commit is contained in:
Dan Harrin
2025-09-14 13:12:54 +01:00
parent 0da91de368
commit 04dbbc89c4
3 changed files with 10 additions and 18 deletions
+1 -1
View File
@@ -512,7 +512,7 @@ class Action extends ViewComponent implements Arrayable
*/
protected function resolveDefaultClosureDependencyForEvaluationByType(string $parameterType): array
{
$record = $this->getRecord() ?? $this->getSchemaContainer()?->getRecord() ?? $this->getSchemaComponent()?->getRecord();
$record = $this->getRecord();
return match ($parameterType) {
Builder::class => [$this->getSelectedRecordsQuery()],
+2 -2
View File
@@ -371,9 +371,9 @@ class ActionGroup extends ViewComponent implements Arrayable, HasEmbeddedView
{
return match ($parameterName) {
'livewire' => [$this->getLivewire()],
'model' => [$this->getModel() ?? $this->getSchemaContainer()?->getModel() ?? $this->getSchemaComponent()?->getModel()],
'model' => [$this->getModel()],
'mountedActions' => [$this->getLivewire()->getMountedActions()],
'record' => [$this->getRecord() ?? $this->getSchemaContainer()?->getRecord() ?? $this->getSchemaComponent()?->getRecord()],
'record' => [$this->getRecord()],
'schema' => [$this->getSchemaContainer()],
'schemaComponent', 'component' => [$this->getSchemaComponent()],
'schemaOperation', 'context', 'operation' => [$this->getSchemaContainer()?->getOperation() ?? $this->getSchemaComponent()?->getContainer()->getOperation()],
@@ -120,10 +120,6 @@ trait InteractsWithRecord
return $record;
}
if ($record = $this->getGroup()?->getRecord($withDefault)) {
return $record;
}
if (($this instanceof Action) && $record = $this->getSchemaContainer()?->getRecord()) {
return $record;
}
@@ -132,11 +128,7 @@ trait InteractsWithRecord
return $record;
}
if ($withDefault && ($this instanceof Action) && ($record = $this->getHasActionsLivewire()?->getDefaultActionRecord($this))) {
return $record;
}
return null;
return ($withDefault && ($this instanceof Action)) ? $this->getHasActionsLivewire()?->getDefaultActionRecord($this) : null;
}
public function getRecordTitle(?Model $record = null): ?string
@@ -248,14 +240,14 @@ trait InteractsWithRecord
$record = $this->getRecord($withDefault);
if (! is_null($record)) {
if (! ($record instanceof Model)) {
return ($withDefault && ($this instanceof Action)) ? $this->getHasActionsLivewire()?->getDefaultActionModel($this) : null;
}
if ($record instanceof Model) {
return $record::class;
}
if ($record = $this->getGroup()?->getModel($withDefault)) {
return $record;
}
if ($this instanceof Action && $model = $this->getSchemaContainer()?->getModel()) {
return $model;
}
@@ -264,7 +256,7 @@ trait InteractsWithRecord
return $model;
}
return null;
return ($withDefault && ($this instanceof Action)) ? $this->getHasActionsLivewire()?->getDefaultActionModel($this) : null;
}
/**