Welcome Guest, Not a member yet? Register   Sign In
Can I use session()->push in a model?
#1

I'm using CodeIgniter 4.4.3 and I would like to know if it is still valid to use session()->push() in a model that extends BaseModel. 

It seems that we can't use session()->get() anymore, but I think that session()->push() is useful if sessions are stored in the database and we need to update a database value that is somehow related to a session. 
Regards.
Reply
#2

According to the documentation:
https://codeigniter4.github.io/userguide...ssion-data
Reply
#3

(11-07-2023, 11:22 AM)JustJohnQ Wrote: According to the documentation:
https://codeigniter4.github.io/userguide...ssion-data
It's strange. I tested using session()->get() in my model, and it returned nothing. I initially thought it might be an upgraded feature or a security measure because using Services in models and libraries isn't recommended. But now I realize that Services still work in models. My apologies for the silly question.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB