CodeIgniter Forums

Full Version: Data flow (Controller filters and redirects)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have an application where I need to fetch alot of data from MySQL and I do so with my models. I use my models in the BaseControllers construct to be able to use them in all my controllers.

I also have a check in my BaseController and if the data I fetch is not what I except I redirect the user to the login page. However, redirects doesn't seem to work from the constructor (I 
use return redirect()->to(base_url('/account/logged_out'))Wink. So I figured it's time to get to learn controller filters which seems to be great. However - I need my database data in the filter. OR be able to fetch the data in the filter and make the data globally accessible. Is that possible?

I don't see a way of adding arguments to filters if I don't use it from a route adder.

I'm trying to figure out a way of getting the database data that is fetched in the BaseControllers construct everywhere. If I could add data to the request object or a memcache or something? How would you approach this?