DEV Community

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

Collapse
 
kevinwaxi profile image
kevin waxi

i think i would prefer saving banned users with time

Collapse
 
shanisingh03 profile image
shani singh

I think this is Just for starting point, you can always extend it according to your use case.

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