Replies: 1 comment 5 replies
-
List of all features does not depend on the organisations so why the need to link it? You can use the append. in your model
https://laravel.com/docs/10.x/eloquent-collections#method-append |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have models
Organization
andFeature
, with abelongsToMany
relationship between them (i.e. an organization has multiple features, and a feature can be used by multiple organizations).I am being asked for a simple "list of all features, indicating which of those features are enabled for the given organization."
One of my coworkers used the following query to do it:
I'm trying to figure out if there is a more "Laravel-style" way to write this.
Obviously I can just translate this query to use the query builder, but is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions