Closed jmicarus12 closed 2 years ago
Do you mean like this?
public function posting_province()
{
return $this->belongsToThrough(
Province::class,
City::class,
null,
'',
[City::class => 'posting_city_id']
);
}
Thank you, i thought it was only for deeper relationships.
`public function city() { return $this->belongsTo(City::class); }
public function province() { return $this->belongsToThrough(Province::class, City::class); }
public function posting_city() { return $this->belongsTo(City::class, 'posting_city_id'); }
public function posting_province() { return $this->belongsToThrough(Province::class, City::class, 'posting_city_id'); }`
Is it possible to have a custom foreign key on belongsToThorugh ? I tried the current code but its not working.