Hi catalisio,
It's because the find method create a new instance of query.
public static function find($id, $columns = array('*'))
{
if (is_array($id) && empty($id)) return new Collection;
$instance = new static;
return $instance->newQuery()->find($id, $columns);
}
That why don't use find and use a query like:
$model = new EloquentModel();
$model->setConnection('connection_name');
$result = $model->where($this->model->getKeyName(),'=',1)->get()->last();
@mfrancois You're correct. However, this is the way to query on the instantiated model:
$model->newQuery()->find(1);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community