【发布时间】:2016-12-11 10:36:52
【问题描述】:
控制器
public function store( Request $request,$id)
{
$new = Car::find($id);
$new->status = $request ->input('field');
$new->save();
redirect('home');
}
查看
@foreach($users as $user)
@foreach($user->cars as $users)
{!! Form::open( ['route' => 'user.store', 'method'=>'post','id'=> '$users->id']) !!}
<th scope="row">1</th>
<td>{!! Form::label($cars->name)!!}<td>
<td>{!! Form::label($cars->age)!!}<td>
<td>{{Form::select($cars->status, ['R' => 'Requested', 'C' => 'Coming', ['name' => 'field']])}} // name is worong but I dont know the alternative
<td>{!! Form::submit('Update Profile', ['class' => 'btn btn-primary']) !!}</td>
{{ Form::close() }}
路线
Route::Resource('user', 'UserController');
问题
尝试将所选值从 status 保存到汽车模型中。但我收到有关参数的错误。有人可以告诉我我的错误在哪里吗?我是 Laravel 的新手。
【问题讨论】:
标签: php laravel drop-down-menu laravel-5.3