I'm trying to craft a route for a controller that will submit some data to a database. My URL is as follows:
http://example.co.uk/posts/5/edit?type=job
I've tried
Route::post('/posts/{id}/edit?type={role}', '[email protected]');
but am unsure if this will fly?
Best How To :
Don't add parameters in your route:
Route::post('/posts/{id}/edit', '[email protected]');
In your controller, just check if parameter exist:
$type = Input::has('type') ? Input::get('type') : null;
Don't worry about HTTP verb, as Input
access for all verbs (POST,GET,PUT,DELETE...).
Edit
As pointed out by @Antoine, you can simply specify the default value in the get
method
$type = Input::get('type', null);