Reputation: 839
I have a page you get to after entering in information from a search page. So the user goes to the search page, filters down to what they want, once there they choose which rental they want to view and click the view button which has a query string with parameters on it. This goes to:
Route::get('rental/{rental}', 'RentalsController@rental');
That part works fine. They get to the rental page through the rental controller which takes the parameters and shows the correct info. While on the individual rental page they can still narrow it down a little further if they want. Bedrooms, dates and guests are all filterable options on that page ( as they were on the rentals page as well ). The problem is when trying to submit the form i cannot figure out how to get it back to the rental controller with the form values while using a slug that is generated on the blade page.
This is what it looks like:
{!! Form::open(['action' => route('rental/'{{$rental->slug}}, 'method' => 'GET', 'id' => 'rentalform']) !!}
Part of the reasoning here is I need to maintain domain.com/rental/rental-slug?params for the marketing people.
Upvotes: 0
Views: 218
Reputation: 5552
Change 'action'
to 'url'
:
{!! Form::open(['url' => "rental/{$rental->slug}", 'method' => 'GET', 'id' => 'rentalform']) !!}
In laravelcollective/html
form builders, the action
key in Form::open
expects a controller method in the form of 'Controller@method'
, not a url.
https://laravelcollective.com/docs/5.4/html#opening-a-form
Upvotes: 1