DEV Community

Discussion on: How to Ban/Suspend Users in Laravel 8

Collapse
 
cyrillkalita profile image
Cyrill Kalita • Edited

Second that; there is a common pattern, where a binary state (active/inactive, deleted/ not deleted, archived/not-archived) could be achieved with a timestamp - which in our case not only tells the admin since when the user is banned, but also allows for un-banning after, say a month.

And then the name of the field becomes banned_at and the rest of inspiration should come from SoftDeletes trait

I understand this is a Middleware example, so 1/0 is a good starting point; it just can be extended.

Collapse
 
shanisingh03 profile image
shani singh

Well That's correct Thanks for detailed comment. @cyrillkalita