Skip to content

Commit

Permalink
passthru from property to underlying query object
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 13, 2021
1 parent 24fc129 commit 127334a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Illuminate/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ class Builder
*/
protected $onDelete;

/**
* The properties that should be returned from query builder.
*
* @var string[]
*/
protected $propertyPassthru = [
'from',
];

/**
* The methods that should be returned from query builder.
*
Expand Down Expand Up @@ -1600,6 +1609,10 @@ public function __get($key)
return new HigherOrderBuilderProxy($this, $key);
}

if (in_array($key, $this->propertyPassthru)) {
return $this->toBase()->{$key};
}

throw new Exception("Property [{$key}] does not exist on the Eloquent builder instance.");
}

Expand Down

0 comments on commit 127334a

Please sign in to comment.