plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: clickable relations not always work when model query starts from ->query()

Open azgooon opened this issue 1 year ago • 4 comments

Bug description

I have noticed that sometimes clickable relations within the model queries stop working when they're preceded with ->query() method.

not clickable relations

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

azgooon avatar Feb 14 '24 14:02 azgooon

Hello. It is because of the "query" relation in the Bank model. I'll try to fix this somehow.

adelf avatar Feb 19 '24 11:02 adelf

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!

azgooon avatar Mar 26 '24 13:03 azgooon

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.

adelf avatar Apr 09 '24 04:04 adelf

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.

azgooon avatar May 20 '24 13:05 azgooon

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.

gorbunov avatar May 20 '25 18:05 gorbunov