Closed
Description
I wanted to create a constructor for my model to give some fields some default values. I created the constructor like this:
protected $fillable = array('_id');
public function __construct($attributes = array(), $exists = false)
{
parent::construct($attributes, $exists);
$this->wigets = array();
$this->starredDocuments = array();
$this->last_accessed_date = date('m/d/Y g:i:s A'); // e.g. 08/23/2013 1:23:45 PM
}
My plan requires me to first check if an entry exists with the given key before creating a new one and saving it. When I call "find" on my model, I get a BadMethodCallException: Call to undefined method Jenssegers\Mongodb\Builder::construct()
Metadata
Metadata
Assignees
Labels
No labels