2016-11-16 53 views
0

我有這種形式的更新我的數據怎麼能得到形式的行動路徑laravel 5.2

<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'=>'[email protected]',]); 

我需要我怎麼給我的表單動作

<form class="form-vertical" role="form" method="post" action=""> 

回答

0

您可以定義您的路線:

Route::put('projects/{projects}/collaborators/{id}',['uses'=>'[email protected]', 'as' => 'projects.collaborators.update']); 

然後在你的表格你可以做:

<form class="form-vertical" role="form" method="post" action="{{ route('projects.collaborators.update', ['projects' => 1, 'collaborators' => 2]) }}"> 

Docs