First let's clean up that first function a bit; you don't need those variables, and even what you're passing to the view looks overboard.
public function show($id) {
$class = Subject::where('id', $id)->first();
if($class->user_id == Auth::id()) {
return View::make('subjects.show', array(
'class_name' => $class->subject_name,
'class_id' => $class->id,
'title' => $class->subject_name,
'userFirstname' => Auth::User()->firstname,
'userLastname' => Auth::User()->lastname,
'userEmail' => Auth::User()->emailaddress,
'id' => Auth::id(),
'user' => User::find('id'),
));
} else {
return Redirect::to('dash');
}
}
And to get the right id you need to pass it to create() like so:
{{ HTML::link('http://test.com/create/'.$class_id) }}
Then your create() becomes create($id).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community