City.php調用未定義的關係[城市]的模型[應用程序型號 Municipal_district]
public function municipal_districts()
{
return $this->hasMany('App\Models\Municipal_district');
}
Municipal_district.php
public function province()
{
return $this->belongsTo('App\Models\City', 'city_id');
}
哪裏錯了?
城市()的關係在哪裏? –
在Municipal_district.php中'公共職能城市() { return $ this-> belongsTo('App \ Models \ City','city_id'); } ' –
它是否在Municipal_district.php? –