mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
clean up
This commit is contained in:
@@ -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()],
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user