Support the ongoing development of Laravel.io →
posted 7 years ago
Views Blade

Hi,

I want to pass several fields to a route when a link is pressed. This raises the following exception:

Missing required parameters for [Route: programmerUtilities.generic_method_request_2parms] [URI: admin/programmerUtilities/{parm1}/{parm2}/generic_method_request_2parms]. (View: /home/vagrant/Code/l5_larablues2/resources/views/baseline_blades/programmerUtilitiesMenu.blade.php) (View: /home/vagrant/Code/l5_larablues2/resources/views/baseline_blades/programmerUtilitiesMenu.blade.php)

The relevant code in my blade:

		   	@foreach($menu_array as $name=>$method)
				<li>
			   		<?php	
			   		$a = array('a'=>'0',
			   			'b'=>'1',
			   			'c'=>'2',
			   			);
			   		//$a = "abcdef";
			   		$a = json_encode($a);
			   		?>
			   		<a href="{{ URL::route(
			   		'programmerUtilities.'.$method, [
				   		'parm1'=>$name,
			   			'parm2'=>$a
			   			]
					) }}" class="btn mycart-btn-row2">{{$name}}</a>
			   	</li>
		   	@endforeach

(In reality, $a is dynamically defined, but for the purposes of clarity, I hardcoded an example snippet.) If you un-comment the line that sets $a to a simple string, the code works and 'programmerUtilities.'.$method is loaded and all is well

Here's what the route looks like:

    //*                       
    //*                       
    $method_name            = "generic_method_request_2parms";
    $parm1                  = "parm1"; // assigned elsewhere 
    $parm2                  = "parm2"; // assigned elsewhere 
 
    Route::get('admin/'.$node_name
        .'/{'.$parm1.'}'
        .'/{'.$parm2.'}'
        .'/'.$method_name, 
        array('uses'=>$controller_name.'@'.$method_name))->name($node_name .'.'.$method_name); 


And here's the controller definition:

    public function generic_method_request_2parms($parm1,$parm2) {

It took some time to figure this out as the parameter list count was correct as far as I could tell. It took setting everything to strings to validate the navigation before i could isolate what was happening.

I still don't know for sure if it's the route. I need some help please.

tia

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

stu3881 stu3881 Joined 22 Nov 2014

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.