I have a form request payload as follows:
_token: 4xwqi40hwNsiL3yPeZuCXxwH08h4TrPhJsu0KYq5
name: some name
slug: some slug
description: some longer description
display_order:1
active_date:2013-04-26
action: https://app.dev/admin/collection/9/update
class: App/Http/Requests/Admin/Collection/UpdateCollectionRequest
I have a couple routes in route.php with something like the following:
Route::post('admin/collection/{collection}/update', 'CollectionController@updateCollection');
Route::post('admin/validate', 'AjaxValidation@validate');
The form data above is being POSTed to the validation route. The logic behind the validation route knows that I'm going to submit my data to action and uses the provided request class to validate the input prior to form submission to said route. I'm trying to grab the {collection} parameter in a reliable way that doesn't rely on knowing the segment index.
I'd like to match the value of action against the known routes in the application and have it (at least) return something like within the App/Http/Requests/Admin/Collection/UpdateCollectionRequest class:
array(
collection => `9`
)
I have a feeling that something like this is possible, but after poking around in UrlGenerator and Http\Request I'm not finding anything of use.
What do you guys think? Any help would be greatly appreciated.
--- Edited to provide more clarity on what we're after ---