📌  相关文章
📜  急切加载hasmany属于关系 - PHP代码示例

📅  最后修改于: 2022-03-11 14:53:40.140000             🧑  作者: Mango

代码示例1
class Post extends Model
{
   //in case of belongs to relationship we need to specify foreign key
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}