Reputation: 10230
I have the following code in my anchor tag in my laravel application:
<a href="{{ route('showQualityResult' , compact(Session::get('quality-data'))) }}">Submited Quality Check</a>
My route is set to run the following method when clicked on the above link:
public function showQualityResult($qualityData) {
return $qualityData;
// return view('quality-result' , compact($qualityData));
}
Now when i click on the link, i get the following error:
Why am i getting a Missing argument 1
error when i clearly am passing data as a parameter in the tag like so below:
<a href="{{ route('showQualityResult' , compact(Session::get('quality-data'))) }}">Submited Quality Check</a>
Why is the parameter not being passed to the method ?
Upvotes: 1
Views: 1147
Reputation: 163768
Your route from your previous question:
Route::get('/showQualityResult', 'QualityCheckController@showQualityResult');
To pass the parameter, you should define it. So, it'll look like this:
Route::get('showQualityResult/{data}', 'QualityCheckController@showQualityResult');
And showQualityResult()
method should accept it:
public function showQualityResult($data)
{
....
I'd recommend you to read the docs to understand how it works.
Upvotes: 3