You have to call parent::__construct
to make things work here, if you look at the constructor of the Eloquent
class:
public function __construct(array $attributes = array())
{
if ( ! isset(static::$booted[get_class($this)]))
{
static::boot();
static::$booted[get_class($this)] = true;
}
$this->fill($attributes);
}
The boot
method is called and the booted
property is set. I don't really know what this is doing but depending on your problem it seems relevant :P
Refactor your constructor to get the attributes
array and put it to the parent constructor.
Update
Here is the needed code:
class MyModel extends Eloquent {
public function __construct($attributes = array()) {
parent::__construct($attributes); // Eloquent
// Your construct code.
}
}