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

You just need to specify the foreign key, by default the foreign key would be location_id but you want to override that default with your own for example

public function origin_location()
{
    return $this->belongsTo('Location', 'origin_location_Id');
}

Good luck.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

archer3cl archer3cl Joined 7 Mar 2015

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.