I have a simple search form with a single input box. I want the input value to appear in the route URL as a parameter, like:
http://www.website.com/search/{value}
An example might be:
http://www.website.com/search/bob
I also want the route to have an optional value at the end:
http://www.website.com/search/{value}/{optional?}
How can I have the form data be transferred to the route parameter?
Here's the form (nothing special):
<form action="{{ url('/search') }}" method="GET">
<input class="form-control" name="query" type="text" placeholder="Search">
<button type="submit" class="btn btn-link">Submit</button>
</form>
I can also use jQuery/Ajax if that helps.