Laravel Dropdown所选项目发送到编辑视图

时间:2017-07-21 03:38:44

标签: laravel view dropdown

这是我的查看索引页

<div class="form-group">
    {!! Form::label('cname','Clients: ') !!}
    {!! Form::select('cname',[''=>'Select Category']+$client,null,['class'=>'form-control selectpicker']) !!}
    <span class="input-group-btn">
        <a class="btn btn-primary" href="">Edit</a>
    </span>
</div>

控制器

public function index() {
    $client = Client::pluck('cname','clientid')->all();
    return view('client.index', compact('client'));
}

如何从下拉列表中选择项目,然后从按钮单击发送所选详细信息以编辑视图?

1 个答案:

答案 0 :(得分:0)

你可以做这样的事情

hash['001']

然后在你看来

{
'MX1' => schedule[0], # given here in hash form only
'EF1' => schedule[1], # for illustrative purposes,
'HG1' => schedule[2], # I don't need to represent
'PN1' => schedule[4], # each match
'SP1' => schedule[3],
'AU1' => schedule[5]
}