one to many relationship not working in Laravel

I think the wrong in your relation in:

Customer Model:

public function language()
{
    return $this->belongsTo('App\Language',  'language_id','id');
}

like in doc the second parameter in the belongsTo should be the foreign_key column. and you can omit them if you followed Laravel convention for naming columns

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top