Laravel 5.5 add form id

Diego picture Diego · Dec 23, 2017 · Viewed 10.5k times · Source

I have the following: {!! Form::model($houses, ['method' => 'PATCH','route' => ['houses.update', $houses->id]]) !!}

and {!! Form::open(array('route' => 'houses.store','method'=>'POST')) !!}

witch result in: <form method="POST" action="http://localhost/j/public_html/houses/2" accept-charset="UTF-8">

and <form method="POST" action="http://localhost/j/public_html/houses" accept-charset="UTF-8">

How do I add an <form id="houseform" ... in both of them??

Thanks

Answer

Marcin Nabiałek picture Marcin Nabiałek · Dec 23, 2017

You can use:

{!! Form::model($houses, [
           'method' => 'PATCH',
           'route' => ['houses.update', $houses->id], 
           'id' => 'houseform'
   ]) !!}

Similar for 2nd:

{!! Form::open(array('route' => 'houses.store','method'=>'POST', 'id' => 'houseform')) !!}