class User
{
public static function is_online($user) { }
}
$online = User::is_online($user);
Creating a method accessible from all controllers
-
16-01-2022 - |
Question
I need to make a model method which can be accessed from all other controllers, regardless of parents and modules.
I'm using CodeIgniter and HMVC patterns, if that have anything to say.
What I am looking for is identical to static
classes/methods in Java
Edit: I need this to check wether a user is online or not. Putting it in the User Model
will not suffice, as I need to check if a user is online in plenty other modules
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow