Open nowendwell opened 3 years ago
@cyrillkalita I was actually thinking about separating the model entirely and going with a morphable approach.
term_id | termable_type | termable_id | created_at |
---|---|---|---|
1 | App\Models\User | 1 | 2021-04-07 14:07:00 |
1 | App\Models\Account | 1 | 2021-04-07 14:08:00 |
That way anything could really have terms applied to it using the trait.
This would be a breaking change so targeting 2.0
The only thing I haven't thought about yet is the middleware. With users it's easy cause I can check after login. If it's tied to something else it's kinda hard to check. I might pull the middleware out of the package and add it to the readme as an example use case. Then devs can decide how to incorporate into their apps.
Let me know your thoughts.
Same as authentication, I guess: there would need to be a Termable
contract and default middleware assumes User, but one can add their own implementation for terms:{termable}
, with some sort of resolution logic?
model needs to be configurable (i am like a super fan of how spatie does that). something along the lines of config\terms.php