datavoredan
datavoredan

Reputation: 3746

laravel 5.2 - passing route parameter to controller

I have the following route in a Laravel application:

Route::get('/post/view/{id}', 'PostController@getView');

However I am unsure how to use the id passed as a parameter in the Controller method PostController@getView.

Is there a simple way to pass the route parameter into the desired controller method?

Upvotes: 3

Views: 4034

Answers (1)

Gagan
Gagan

Reputation: 5656

Have you tried this code? This method should be in your controller.

   public function getView($id)
   {
      dd($id);
   }

Let me know if that helped.

Thanks

Upvotes: 3

Related Questions