From fd1b76a2962f53195c23d0735930df8eee88a27b Mon Sep 17 00:00:00 2001 From: JoostK Date: Tue, 18 Dec 2012 16:21:06 +0100 Subject: [PATCH] Added ability to call Eloquent::with on a Relationship instance Signed-off-by: JoostK --- .../eloquent/relationships/relationship.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/laravel/database/eloquent/relationships/relationship.php b/laravel/database/eloquent/relationships/relationship.php index 34c03f6b..99785d3a 100644 --- a/laravel/database/eloquent/relationships/relationship.php +++ b/laravel/database/eloquent/relationships/relationship.php @@ -119,4 +119,17 @@ public function keys($results) return array_unique($keys); } + /** + * The relationships that should be eagerly loaded by the query. + * + * @param array $includes + * @return Relationship + */ + public function with($includes) + { + $this->model->includes = (array) $includes; + + return $this; + } + } \ No newline at end of file