Laravel背包在场上设定值

时间:2017-04-28 13:40:05

标签: php laravel backpack-for-laravel

$this->crud->addField([
        'label' => "Department",
        'type' => 'select_multiple',
        'name' => 'departments',
         // the method that defines the relationship in your Model
        'entity' => 'departments', // the method that defines the relationship in your Model
        'attribute' => 'department_name', // foreign key attribute that is shown to user
        'model' => "App\Models\DepartmentNames", // foreign key model
        'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
    ]);

当我发布阵列'部门'是空的,

<select class="form-control" name="department[]" multiple="">
    <option value="">-</option>
    <option value="">Account Management</option>
    <option value="">Services</option>
    <option value="">Customers</option>
   <option value="">Technical</option>
</select>

departmentNames的架构

- id
-department_name

0 个答案:

没有答案