cybercog/laravel-ban

Add support for more states

imanghafoori1 opened this issue · 3 comments

This package is awesome, but it can still be more useful if you allow the user to set other states.

For example:
I want to temporarily give my user access privileges only for a week, so I give him a "VIP" state (instead of "banned" state) for a week.
Hope you got it.

  • Second:
    Why only the user model? support for other models to have temporary "tags" can be added.
    here we are actually tagging a user with the label of "banned" for a period of time.

In an online shop, we can tag a product model, "out_of_stock" or "discount" for a week.

I can do the coding but I do not like to copy and paste someone else 's code as my starter kit. event if MIT
On the other hand, it is a big breaking change to create a PR for it.
So I if you allow it I use your code as an inspiration to create a new package out of it.

Why only the user model? support for other models to have temporary "tags" can be added.

As documentation states: "Use case is not limited to User model, any Eloquent model could be banned: Organizations, Teams, Groups and others."

This achieved using morphs columns:

$table->morphs('bannable');

This package was developed to restrict access, not to promote or change visibility option of the model.

Feel free to use this package as boilerplate to create new package to satisfy your requirements.

Yeah, I saw it afterward.
But other types of tags could be nice.
Thank you for responding

This was born as a result, you may not see very similarity though

https://github.com/imanghafoori1/laravel-temp-tag