Voyager: [BUG] Select search returns no results on belongsTo relationship using additional_attribute

Created on 13 Jul 2019  路  2Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v5.7.28
  • Voyager: v1.2.6
  • PHP: 7.1
  • Database: MySQL 5.7.26

Description


When using a belongsTo relationship and selecting an additional_attribute as the display column, at the time of adding a new model and searching using the select2 ajax searchbar, an error is reported as the MySQL query tries to look for the additional_attribute as a column in the table.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Add an additional_attribute to a model (_Model1_)
  2. Add a belongsTo relationship from another model (_Model2_) to the model with the additional_attribute (_Model1_)
  3. Select the additional_attribute as the display column for the belongsTo relationship
  4. Try create a new _Model2_ and use the search bar in the relation field to _Model1_
  5. No results should be returned
  6. An error should be logged to the error log with something like SQLSTATE[42S22]: Column not found: 1054 Unknown column

Expected behavior

When searching for _Model1_ names, they should be filtered and returned to the list

Screenshots

image
image
image
image
image

addressed possible bug

Most helpful comment

Fixed in #4562

All 2 comments

Fixed in #4562

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

winex01 picture winex01  路  3Comments

rayqiri picture rayqiri  路  3Comments

iwasherefirst2 picture iwasherefirst2  路  3Comments

wp-src picture wp-src  路  3Comments

kevinjon27 picture kevinjon27  路  3Comments