Welcome Guest, Not a member yet? Register   Sign In
Where to store login information in codeigniter.
(This post was last modified: 05-07-2022, 06:36 PM by yoshi.)

Perhaps this is more of a web application topic than codeigniter.

When a user logs in, the session retains the user id, so I can retrieve the entity from the user table in the controller immediately after login as follows.

PHP Code:
// e.g. 'user' model
  ["id"]=> string(1"2"
  ["email"]=> string(19"[email protected]"
  ["username"]=> string(30"demo_teacher2"
  ["password_hash"]=> string(60"$2y$10$...."
  ["deleted_at"]=> NULL

I have added a variable to "app\Controllers\BaseController" to retain the model data extracted from the login id even if I have moved some controllers.

Here is the problem.
When I move to another controller, the contents of this variable disappear.

With the School Business Management System, for example, the "school" you belong to will never change while you are logged in.

Therefore, I would like to make it a variable to be remembered while I am browsing, but the value of the "user" model and "school" model will disappear.

Should I extract the model I need from the session id each time in the constructor of each controller?

Messages In This Thread
Where to store login information in codeigniter. - by yoshi - 05-07-2022, 06:27 PM

Theme © iAndrew 2016 - Forum software by © MyBB