How verify if method on model was called by web application or the console application.
The following method does not work when called by the console:
$ Log-> ip = \ Yii :: $ app-> request-> userIP;
$ Log-> usuario_id = \ Yii :: $ app-> user-> id;
Indeed, if we run the console does not exist a user and an IP.
soon, I would have a checker for this method in my model to find out if it’s a web request or console request
ex: if (yii resquest is web app) {
$ Log-> ip = \ Yii :: $ app-> request-> userIP; $ Log-> usuario_id = \ Yii :: $ app-> user-> id;
}