public function __construct($model = null)
{
if ($model) {
if (is_object($model)) {
$this->model = $model;
$this->modelClass = get_class($model);
} elseif (is_string($model)) {
$this->modelClass = $model;
$this->model = new $model();
}
$this->model->schema($this);
$this->build();
}
}