Miss-use of $value/$label in your Filter class #6022
-
Description:In list view of users we have a dropdown to filter users by their roles. This selectbox was build with equal
instead of:
The returns the correct array: I have xdebuged the return value. The array keys and values are correct until now. In your You use my So, first parameter for your But in your callable you use
Would be cool, if you can change Nice greetings Stefan |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
You can change the format to the following: return Role::query()->orderBy('name')->pluck('id', 'name')->toArray();GIven the following example: [
"BusinessPartner DE" => 2,
"BusinessPartner EN" => 5,
"BusinessPartner FR" => 12,
"Partner France" => 12,
]vs [
2 => "BusinessPartner DE",
5 => "BusinessPartner EN",
12 => "BusinessPartner FR",
12 => "Partner France"
]With labels as key, you can have multiple redundant values with different labels. Having value as the key eliminates this possibility. |
Beta Was this translation helpful? Give feedback.
You can change the format to the following:
GIven the following example:
[ "BusinessPartner DE" => 2, "BusinessPartner EN" => 5, "BusinessPartner FR" => 12, "Partner France" => 12, ]vs
[ 2 => "BusinessPartner DE", 5 => "BusinessPartner EN", 12 => "BusinessPartner FR", 12 => "Partner France" ]With labels as key, you can have multiple redundant values with different labels. Having value as the key eliminates this possibility.