Open toto975 opened 2 years ago
Did anyone find exact solution to this ? @Walt2018 your code will only work for specific browse file, what happens if it is showing in all the filters wherever we created a relationships in BREAD ? we can't make custom browse files for each module.
I confirm this PR https://github.com/thedevdojo/voyager/pull/5754 fixes the bug, in these conditions :
Laravel version
9.7.0
PHP version
8.1.4
Voyager version
1.5
Database
MySQL 8.0.28
Description
Search on relationship with serverside pagination
Steps to reproduce
Model Parcours (id, cadre_id, date) Model Cadre (id, name) In the BREAD, Parcours has relationship belongsTo Cadre and display Cadre name
In the Parcours list view, the column Cadre is sortable. But the search field goes to this error :
Expected behavior
The SQL Query must be
select count(*) as aggregate from
parcoursleft join
cadresas
joinedon
parcours.
cadre_id=
joined.
idwhere
cadre.
nameLIKE %NAME% and
parcours.
deleted_atis null
Screenshots
None of theses fixes work for me : https://github.com/the-control-group/voyager/issues/5635 https://github.com/the-control-group/voyager/issues/5449 https://github.com/the-control-group/voyager/issues/5412 https://github.com/the-control-group/voyager/pull/5312 https://github.com/the-control-group/voyager/pull/5245 https://github.com/the-control-group/voyager/pull/5185 https://github.com/the-control-group/voyager/issues/3595
I put same name for cadre_id and Cadre relationship. I check the cadre_id browse. I uncheck the Cadre browse The search is OK. But it's the cadre_id which is displayed. I want the cadre'name
Next I check the Cadre browse The search is OK, it's the Cadre name which is displayed.
But there is both Cadre in the select dropdown search field, one for cadre_id, the other for Cadre relationship
Additional context
No response