johnnw
161
18
Laravel

Trying to get property of non-object sending data to the view

Posted 10 months ago by johnnw

I have this single method that returns a view with conference information.

I want to pass to the view the conference info but also the registration types that exist for that conference. But its not working for the registration types, Im getting "Trying to get property of non-object". Do you know how to fix the issue?

 public function single($slug){
        $conf = Conf::find($slug);
        $registrationTypes = RegistrationType::where('conf_id', $conf->id)->get();
        return view('conf.single')->with('conf', $conf)->with('registration_types', $registrationTypes);
    }

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.