一个帖子属于一个作者,该作者就读一所学校。帖子可通过作者访问作者所在的学校。
简单的说:Thread 模型可以通过 Author 模型访问唯一的 School 模型。
表threads: id, title
authors: id, name, thread_id
schools: id, name, author_id
// 一对一指的是:作者对学校
模型
# App\Thread
public function authorSchool()
一个帖子属于一个作者,该作者就读一所学校。帖子可通过作者访问作者所在的学校。
简单的说:Thread 模型可以通过 Author 模型访问唯一的 School 模型。
表threads: id, title
authors: id, name, thread_id
schools: id, name, author_id
// 一对一指的是:作者对学校
模型
# App\Thread
public function authorSchool()
微信扫码登录