I am new to Laravel and maybe somebody can give me an example for this.
I have two tables - Auhors
and Books
and two views - authors.index
and books.index
.
I know how to display all the books related to author in authors.index, but the question is, how to display all authors related books in books.index
view?
My models and BookController:
Laravel relationships (one to many)
47 views Asked by Joe 222 At
1
You need to use the opposite function
belongsTo
into yourBooks
model.You can find more info here