1

I`m new to the laravel 5.4 and um developing trainee management system.what i need is when i press see details button on right side green color.all the datas under the that Trainee id need to be shown.see the image, enter image description here

for an example if i want to see ID MOB/TR/1739.i need to press see details on right side.hope you got it.in additionally here is the database related to that.

enter image description here

Here is i developed controller for that.

public function user_details($traninee_id)
{
    $trainee_details= registerdetails::where('traninee_id','=',$traninee_id)->get()->first();
     return view('registeredusers.seedetails', compact('trainee_details'));
}

Here is the error um getting.enter image description here

Can anyone suggest me the suggestions to complete it?

5
  • can you show us your route? Commented Jun 17, 2017 at 15:52
  • Please show the route you're trying to use and how do you generate link to this route. Commented Jun 17, 2017 at 15:53
  • Route::get('Seedetails', 'UserRegisterController@user_details'); Commented Jun 17, 2017 at 15:54
  • Try this: Route::get('Seedetails/{id}', 'UserRegisterController@user_details'); Commented Jun 17, 2017 at 15:55
  • i changed but ir dost work Commented Jun 17, 2017 at 16:03

2 Answers 2

1

You're not passing the traninee_id in your route so to fix this update your route to this

Route::get('Seedetails/{id}', 'UserRegisterController@user_details');

And assuming that you're using $traninee to display the content of table so update your See Here button with this

<a href="Seedetails/{{ $traninee->traninee_id }}">See Here</a>
Sign up to request clarification or add additional context in comments.

3 Comments

Sir i change the code but it give error again route error.that means route is not going to work
@Dasun please show me your seedetails.blade.php and also which error?
Sir i`m place it as a new question rather than editing this question.i ll mention you their.
0

The error says there is a problem with the route you use. So add an ID to the route:

Route::get('Seedetails/{traineeId}', 'UserRegisterController@user_details');

And pass the ID when you create a link to this route:

url('Seedetails/'.$traineeId)

4 Comments

Sir i change the route but i dont understand how to create a link passing ID.can you please explain bit?
@Dasun I've shown how in my answer (the url() helper). You also can name your route and use route() helper like <a href="{{ route('your.route.name', ['traineeId' => $traineeId]) }}"></a>
sir as um new to laravel i didnt get what you are saying.sorry
Then you should really read the routing docs laravel.com/docs/5.4/routing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.