Powered by Blogger.

Convert Laravel Collective Form to Html Form


For example, the is a form with a script in Laravel Collective to delete a record. The script like code below.

 {!!Form::open(['action'=> ['UsersController@destroy', $user->id],'method'=>'POST', 'class'=>'pull-left', 'onsubmit'=>'return confirm("Are you sure?")'])!!}  
 {{Form::hidden('_method', 'DELETE')}}  
 {{Form::Submit('Delete', ['class'=>'btn btn-danger'])}}  
 {!!Form::close() !!}  

And there is the script in HTML.

 <form action="{{action('UsersController@destroy', $user['id'])}}" method="post">  
 @csrf  
 <input name="_method" type="hidden" value="DELETE">  
 <button class="btn btn-danger" type="submit" onclick="return confirm('Are you sure?')">Delete</button>  
 </form>  


No comments