jcadima
2/11/2017 - 9:37 PM

Laravel Form Route Model binding without using Laravel Collective

Laravel Form Route Model binding without using Laravel Collective


http://stackoverflow.com/questions/28984369/adding-form-action-in-html-in-laravel

{{ action('AdminUsersController@update',$user->id) }}

<form method="POST" action="{{ action('AdminUsersController@update',$user->id) }}" enctype="multipart/form-data">
  {!! method_field('PATCH') !!}
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <input type="hidden" name="id" value="{{ $user->id }}">

    <div class="form-group">
      <label for="email">Name:</label>
      <input type="text" name="name" class="form-control" value="{{$user->name}}">
    </div>
</form>

Note: we are passing the $user->id to the AdminUsersController update method