I was attemping to access on my instance on the constructor with the variable $this; In all other method it seem work good when i call $this->event->method() but on this method it throw me an error
Using $this when not in object context
I just did a research about this issue and the answers i found was all about the version of PHP but i have the version 5.4. what can be the issue?
This is the method that i try to call the instance.
// all protected variable $event , $team , $app
function __construct(EventTeamInterface $event,TeamInterface $team) {
$this->event = $event;
$this->team = $team;
$this->app = app();
}
/**
* @param $infos array() |
* @return array() | ['status'] | ['msg'] | ['id']
*/
public static function createEvent($infos = array()){
$create_event = $this->event->create($infos);
if ($create_event) {
$result['status'] = "success";
$result['id'] = $create_event->id;
} else {
$result['status'] = "error";
$result['msg'] = $create_event->errors();
}
return $result;
}