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

Était-ce utile?

La solution

class User
{
    public static function is_online($user) { }
}

$online = User::is_online($user);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top