Commit ac8bd082 by Jelle Sebreghts
parent d9802fe6
......@@ -253,7 +253,27 @@ abstract class Model {
*/
public function _with($includes)
{
$this->includes = (array) $includes;
$includes = (array) $includes;
$all_includes = array();
foreach($includes as $include)
{
$nested = explode('.', $include);
$inc = array();
foreach($nested as $relation)
{
$inc[] = $relation;
$all_includes[] = implode('.', $inc);
}
}
//remove duplicates and reset the array keys.
$this->includes = array_values(array_unique($all_includes));
return $this;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment