Answer the question
In order to leave comments, you need to log in
How to bind models in Laravel 5.1?
Hello. There are 2 models: User (the table is called users), customerMfOptions (the table is called customer_mail_forwarding_informations). I get a user
$current_user = $this->user->where('email', $email)->where('role_id', 3)->first();
public function customermfoptions()
{
return $this->hasOne('App\Models\CustomerMfOptions', 'customer_id', 'id');
}
$current_user = $this->user->where('email', $email)->where('role_id', 3)->first();
dd(\App\User::find(1)->customermfoptions);
Answer the question
In order to leave comments, you need to log in
I think the point is that you do not have protected $table set in App\Models\CustomerMfOptions
As far as I remember, the default table names are not formed by camel-cas, so you need to set this property in CustomerMfOptions.
protected $table = 'customerMfOptions';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question