Welcome Guest, Not a member yet? Register   Sign In
User Restriction
#1

(This post was last modified: 03-22-2020, 08:01 PM by PHS.)

Hello friends!

I'm using this wonderful Frameword called CodeIgniter 4 in a personal project.
I confess that I do not fully master all the resources that CI 4 offers, but I have the will to learn day after day its resources, libraries, etc.
My project is a service platform where users register their items and at the end of the month the system generates an invoice considering the number of items registered by each user.
When the invoice is generated, the user has 7 days to pay the invoice, after that period I developed a logic where the system checks the unpaid invoices within the stipulated period and writes a code in tableĀ each user's login.
When the user logs in, if he has not made the payment, the system get that code and save to a session variable.

This way I block the user from accessing all areas of the website, with the exception of the payment area.

To block the user, in each controller I check the methods where pages are displayed to the user, if the code recorded in the session is greater than 1 the user is blocked on that page.

So, I was wondering if there was a more efficient way to do this checking and blocking the user.
In the documentation I read about the filters that can be used, but I have no idea how to use them and if they serve this purpose.

Could someone with more experience in CI 4 give me a hand?

I'm already grateful.
Reply
#2

There are lots of threads on the forums about this already, you might do best to find one that fits your scenario. But basically, you want Filters (https://codeigniter4.github.io/userguide...lters.html)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB