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

Change your email preferences function

public function emailPreferences()
{
    return $this->hasOne('EmailPreference');
}

Then update your call

$user = Auth::user();
echo '<pre>';
print_r($user->emailPreferences);
exit;

When you call $user->email_preferences, Eloquent will try and call $user->emailPreferences() but because this method doesn't exist, it'll return null. See here for more info.

0

Yup! That was the issue. That's pretty annoying ...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

dcolumbus dcolumbus Joined 29 Dec 2014

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.