Closed atmonshi closed 9 months ago
in some cases, need to get the model dynamically or conditionally, so I am using the method:
public function getModel(): ?string { return myMode::class; }
I'll get the error: Class name must be a valid object or a string
Class name must be a valid object or a string
raised from:
protected function getEloquentQuery(): Builder { $query = $this->model::query(); //error // TODO: Scope query to tenant. return $query; }
the solution will be to access the model from the getter or resolve it by the container
protected function getEloquentQuery(): Builder { $query = app($this->getModel())::query(); //fix // TODO: Scope query to tenant. return $query; }
Thanks, InteractsWithRecord is clashing with the Filament one rn, i need to refactor and probably launch a new major to fix it.
in some cases, need to get the model dynamically or conditionally, so I am using the method:
I'll get the error:
Class name must be a valid object or a string
raised from:
the solution will be to access the model from the getter or resolve it by the container