[Bug]: clickable relations not always work when model query starts from ->query()
Bug description
I have noticed that sometimes clickable relations within the model queries stop working when they're preceded with ->query() method.
Plugin version
8.1.0.233
Operating system
Windows
Steps to reproduce
Steps to reproduce would be to construct model query with ->query() method following model class i.e:
$bank = Bank::query()->whereRelation('actionQueues', 'action_queue.id', '=', $this->actionQueue->id)->first();
Relevant log output
No response
Hello. It is because of the "query" relation in the Bank model. I'll try to fix this somehow.
Hello @adelf, I am just checking on this issue to see if you have any idea when this will likely be fixed. While our entire project uses ::query() method it would be a great fix saving a lot of time. Thanks!
Honestly, I don't know how to fix it.
$bank->query()->... - what is here? Bank query builder or Bank "query" relation?
Laravel Idea will think that it is a relation.
I was thinking about a similar manner to the with() method but at the same time, I have not got any experience in plugin building to be able to advise.
Relation definitions of models using names that conflict with existing eloquent methods create undefined behavior. We likely can't do anything here, even Laravel behavior may change for such usage.