public function __call($method, $arguments)
{
if ($this->model()->eloquent() instanceof MongodbModel) {
$label = isset($arguments[0]) ? $arguments[0] : ucfirst($method);
return $this->addColumn($method, $label);
}
$connection = $this->model()->eloquent()->getConnectionName();
if (Schema::connection($connection)->hasColumn($this->model()->getTable(), $method)) {
$label = isset($arguments[0]) ? $arguments[0] : ucfirst($method);
return $this->addColumn($method, $label);
}
$relation = $this->model()->eloquent()->{$method}();
if ($relation instanceof Relation) {
$this->model()->with($method);
return $this->addColumn()->setRelation($method);
}
}