Support the ongoing development of Laravel.io →
Session Database Views
Last updated 2 years ago.
0

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).

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.