Support the ongoing development of Laravel.io →
posted 9 years ago
Requests

assume a set of routes with a pre-filter using something like:

Route::group(['before' => 'subdomain'], function() { .. Route::get( 'subroute/{sub?}', controller_name@function_name ) .. }

in the filter "subdomain", I set a parameter to carry with the route:

$thisRoute->setParameter('pname",pvalue)

now, the controller function looks like:

function_name( $sub = 'optional' ) {

dd($sub)

}

what happens is that $sub is never set to 'optional' and instead is set to the value of pname in the filter.

is there a correct way to do this so that $sub doesn't get mixed up with pname?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sdwarwick sdwarwick Joined 21 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.