0
votes

I am new to Laravel 4. I am trying here is that whenever I click in a link I will go to route, there I will print something. Now one part of the link has to be variable. In the route I want to print the variable.

The code for the link is given below:

URL::to("category/{$category}

This code in routes.php is

Route::get('category/{$c}', function($c){
    return $c;
});

It is showing me:

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException.

1
You need to return a view such as: return View::make($c);instead of your echo statement. Have a read of this part of the docs: laravel.com/docs/responses - Softinio
Route::get('category', function(){ return 'Here'; }); - odbhut.shei.chhele
@IncitoNetworks, But when I try to add a variable then it is giving me an error - odbhut.shei.chhele

1 Answers

2
votes

Try this ({c} instead of {$c})

Route::get('category/{c}', function($c){
    echo $c;
});