Dasun
Dasun

Reputation: 612

Laravel Database Query Error

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?

Upvotes: 1

Views: 99

Answers (2)

Zayn Ali
Zayn Ali

Reputation: 4915

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>

Upvotes: 1

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

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)

Upvotes: 0

Related Questions