I'm getting this strange error which I have never got before.
Fatal error: Using $this when not in object context
Chat.php (class)
<?php
class Chat {
private $_data = array(),
$_db;
public function __construct($row){
$this->_db = DB::getInstance();
$this->_data = $row;
}
public function send($fields = array()) {
$this->_db->insert('messages', $fields); <------- ERROR
}
When I call the send function like this:
Chat::send(array(
'message' => Input::get('message'),
'author' => $user->data()->username,
'ts' => date('Y-m-d H:i:s')
));
The error pops up.