Last active
March 19, 2018 08:07
-
-
Save Ellrion/496d7bcdfc725bde31e40adb9082de5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Illuminate\Database\Eloquent\Collection::macro('loadIt', function ($relation) { | |
return $this->load($relation)->reduce(function($relations, $model) use ($relation) { | |
return $relations->merge($model->{$relation}); | |
}, new Illuminate\Database\Eloquent\Collection()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
return $raltion
raltion?