I have Two tables
1) countries 2) affiliates
The models are Country.php and Affiliate.php
countries table :
id
name
etc..
affiliates table
id
name
country_id
etc..
Now my Model methods
Affiliate.php
public function Country() {
return $this->belongsTo('App\Country');
}
Country.php
public function Affiliates() {
return $this->hasMany('App\Affiliate');
}
For me, Affiliates is returning correct results but Country is returning null
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire