with 的具体用途
例如: techer hasMany students
我希望 find teacher 时,students 作为属性 techer->students 即可立即使用,而不需要额外的 sql 语句。
看了一下 with 的用法,貌似不能达成这个目标。
补充:使用 $techer->students 是否会执行 sql 语句,或者是 eagar loading 早执行过了,谢谢。
新人,问得唐突。
推荐文章: