I created a default_manufacturer_id field to a table and am trying to show the options under $manufacturer_list in a drop down. The drop down populates fine, but the previous value of default_manufacturer_id is not shown up as selected by default.
If I hard-code a specific value with the "value" key in the addField, then that value is shown up as selected. I was expecting the previous value of the default_manufacturer_id field to show up.
CRUD::addField([
'name' => 'default_manufacturer_id',
'type' => "select_from_array",
'label' => "Default Manufacturer",
'options' => $manufacturer_list,
'allows_null' => false,
]);
What is stopping this value from showing up as selected automatically? I have checked the database, and the value being saved is correct.
Version numbers are as follows:
root@f9c300ad6814:/var/www/html# php artisan backpack:version
PHP VERSION:
PHP 8.1.13 (cli) (built: Nov 26 2022 14:07:55) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.13, Copyright (c) Zend Technologies with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
LARAVEL VERSION:
v9.49.0@e02d9453442ad0a6a2f5dc9df96ea0319d218026
BACKPACK PACKAGE VERSIONS:
backpack/crud: 5.4.11 backpack/pro: 1.1.2 backpack/generators: v3.3.7
With Regards, Sharat