• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data flow (Controller filters and redirects)

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?


Messages In This Thread
Data flow (Controller filters and redirects) - by legon614 - 08-10-2020, 02:49 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.