I am using laravel framework to develop api’s ,it’s an existing application .there is a requirement if more than 5users registered from 6th user onwards i have to restrict them to use application until they approved by manager or they paid for registration fee then only the user will allow to use the application.
Can anyone give me the idea how to acheive this scenario or suggest me any package in laravel
2
Answers
Solution:
You can add ‘status’ field in your table. Now when your api is registering a user, you can check the No. of users in the database. If more than or equals to 5, you can set the status to 0. Now show the manager list of user with status 0 and when the status changes you can use the application.
Make sure to add condition where status = 1 when user is getting logged in.
I hope it helps!
Well, you can just put a
isApproved
column to indicate if the user is already approved or just like theemail_verified_at
that accepts timestamp as a value then create amiddleware
where you can check if the user isapproved
ornot
. then add a method to the user model to check if the user is approve :User model
Middleware
You can check this for more information about middleware