我已使用此表单更新我的数据
<form class="form-vertical" role="form" method="post" action="">
<div class="form-group{{ $errors->has('comments') ? ' has-error' : '' }}">
<input type="text" name="comments" class="form-control" id="comments" value="{!! $comment->comments ?: '' !!}">
@if ($errors->has('comments'))
<span class="help-block">{{ $errors->first('comments') }}</span>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-info">Update Commment</button>
</div>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
{!! method_field('PUT') !!}
</form>
此表格路线是
Route::put('projects/{projects}/collaborators/{id}',['uses'=>'ProjectCollaboratorsController@update',]);
我需要如何进行表单操作
<form class="form-vertical" role="form" method="post" action="">
答案 0 :(得分:0)
您可以将路线定义为:
Route::put('projects/{projects}/collaborators/{id}',['uses'=>'ProjectCollaboratorsController@update', 'as' => 'projects.collaborators.update']);
然后在您的表单中,您可以这样做:
<form class="form-vertical" role="form" method="post" action="{{ route('projects.collaborators.update', ['projects' => 1, 'collaborators' => 2]) }}">
答案 1 :(得分:0)
另一种选择是使用Laravel Collective。
然后,您可以创建与echo Form::open(['action' => 'Controller@method'])