Laravel背包,如何设置addColumn
Laravel backpack, how to set addColumn
如何设置 addColumn 类型 => select,选项值为 value="1" 而不是 value="name"
这是我的代码:
$this->crud->addColumn([
// 1-n relationship
'label' => "Unit",
'type' => "select",
'name' => 'measurement_id',
'entity' => 'measurement',
'attribute' => "name",
'model' => "App\Models\Measurement",
]);
HTML 结果
<option value="Name">Name</option>
我想通过 id 设置选项值,
<option value="1">Name</option>
确定您要添加的是列而不是字段。如果是你应该写的字段。
$this->crud->addField([
// 1-n relationship
'label' => "Unit",
'type' => "select",
'name' => 'measurement_id',
'entity' => 'measurement',
'attribute' => "name",
'model' => "App\Models\Measurement",
]);
如何设置 addColumn 类型 => select,选项值为 value="1" 而不是 value="name"
这是我的代码:
$this->crud->addColumn([
// 1-n relationship
'label' => "Unit",
'type' => "select",
'name' => 'measurement_id',
'entity' => 'measurement',
'attribute' => "name",
'model' => "App\Models\Measurement",
]);
HTML 结果
<option value="Name">Name</option>
我想通过 id 设置选项值,
<option value="1">Name</option>
确定您要添加的是列而不是字段。如果是你应该写的字段。
$this->crud->addField([
// 1-n relationship
'label' => "Unit",
'type' => "select",
'name' => 'measurement_id',
'entity' => 'measurement',
'attribute' => "name",
'model' => "App\Models\Measurement",
]);