php - laravel 4 - wrong id out of 2 id's within the routes


I am trying to work my way with this route:


and within the posts controller (inside the show function) i try to get the $id of the post but i get the user id (1).


Route::resource('users.posts', 'PostsController');

and here is my function within post controller:

public function show($id)
    dd($id);//output 1



You may try this:

public function show($user_id, $post_id)
    dd($post_id); // 10

Both parameters will be passed to child resource controller method (show) and the first parameter is theparent id and the second one ischild id.

People are also looking for solutions to the problem: Convert or parse a string containing feet and Inches to number in PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.