I am creating a SAAS app using Spark and would like some of your thoughts on how to manage team users. I will be using team billing and will charge $6 per user per month.
Team owners will need the ability to add or remove users at any time. The app is for accountants who will likely add temporary employees during tax season and remove them immediately after tax season. But I want the data created by removed users to still be available in the app.
For example, an accountant may want to run a report on how much time the removed user spent on a particular client during April for billing purposes. So the removed user's data should remain available in the system.
Spark adds an entry to the "team_users" table when a user is added and removes that entry when the user is removed.
I am thinking about 2 options to accomplish this:
#1 Use soft deletes on the "team_users" table. I believe this will require me to modify the Spark source code and I'm not really sure where to start with that.
I also need to use the Spark events, TeamMemberAdded and TeamMemberRemoved to increment and decrement the user quantity for a subscription.
#2 Create a new role called "inactive" in addition to the "Owner" and "Member" roles that are already available. Then I would allow the team owner to change a user's role to "inactive".
I could still use the Spark TeamMemberAdded event to increment the subscription when a brand new user is added. I would need an event to decrement the subscription quantity when a user is made "inactive". I would also need another event to increment the subscription when a team member is made "active" again.
I guess I could write a middleware to deny access to all routes if a user has a role of "inactive".
I'm using Laravel 5.2 and Spark 1.0.14.
If you have done something similar or have any thoughts about this please let me know.