Hey, so what I have is a form that is going to appear on multiple pages for different scenarios, and being sent to different controllers depending on the scenario. I'd like to have just the one blade template with the same form, but I'm wondering what I would specify as the form's action. The only thing that comes to mind is having it sent to a controller or helper class with a parameter that tells it which scenario-specific controller it should be sent to, but from what I gather, controller->controller routing isn't best practise. What can I do to reuse this form?
Can't you just create the Form open and Form close for each specific page, and include only the form fields? Something like
{{ Form::open(['route' => 'my.route']) }}
@include('form_fields')
{{ Form::close() }}
You can also do
@include('myform', array('var1' => 'value', 'var2' => 'othervalue'));
to send variables to the included file. Then inside that, do
{{ Form::open(['route' => $var1]) }}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community