Tag Info

New answers tagged


I think you should really look into using inheritance to manage this particular issue. Inheritance Table inheritance does many things in PostgreSQL, and I'd highly recommend you refer to the online documentation about inheritance to get a feel for what it does and how it might work for you. Since you stated that your comments are all structurally similar, ...


What you expected to have actually exists in Eloquent. In order to attach/detach related models you need to call attach/detach methods on the relations and pass a single ID or array of IDs: $user->roles()->attach($roleId); $user->roles()->attach([$roleId1, $roleId2]); $role->users()->attach($userId); $role->users()->attach([$userId1, ...


A couple of cmments: CommentReplies seems to be implementing many-to-many. I would expect it to be one-to-many -- as in, each comment has one 'parent'. One-to-many does not need an extra table; you simply have parent_id as a column in Comments. Consider using ENUM datatype instead of adding a XxTypes table.

Top 50 recent answers are included