Nagraj722
7 months ago

Laravel relationship suggestion

Posted 7 months ago by Nagraj722

Hi.. i need a suggestion, i have a two tables articles and authors. my scenario is every article have more then one author. My problem is, how to get author data with article. i know the solution with belongsToMany relationship with pivot table. is there any solution without use pivot table. Thanks..

Article_table 
---------------------------------------
| id | title      | author_id   |
---------------------------------------
| 1  | title 1   | 1,2               |
---------------------------------------
| 2  | title 2   | 3,4,5            | 
---------------------------------------

Authors_table 
-----------------------
| id | name      |
-----------------------
| 1  | name 1   |
-----------------------
| 2  | name 2   |
-----------------------
| 3  | name 3   |
-----------------------
| 4  | name 4   |
-----------------------

Please sign in or create an account to participate in this conversation.