Skip to content

Commit

Permalink
Merge pull request #5562 from Laravel-Backpack/checklist-field-option…
Browse files Browse the repository at this point in the history
…s-consistency

make checklist options consistent with other relationship fields
  • Loading branch information
pxpm authored Jul 15, 2024
2 parents 67cc080 + f0bbb14 commit ded2a09
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/resources/views/crud/fields/checklist.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
$field['options'] = $field['model']::all()->pluck($field['attribute'], $key_attribute)->toArray();
} else {
$field['options'] = call_user_func($field['options'], $field['model']::query());
if(is_a($field['options'], \Illuminate\Contracts\Database\Query\Builder::class, true)) {
$field['options'] = $field['options']->pluck($field['attribute'], $key_attribute)->toArray();
}
}
// calculate the value of the hidden input
Expand Down

0 comments on commit ded2a09

Please sign in to comment.