Is there a way to merge 2 relationships in laravel?
this is the way it\'s setup now, but Is there a way I could return both merged?
public function
In case you prefer merge() method to combine two collections (relationships), it will override elements with the same index keys so you will loose some of your data gained from one relationship.
You should choose push() method instead, which creates new array keys by pushing one collection to the end of other collection
Here is a sample :
public function getCompetitionsAttribute($value) {
$competitionsHome = $this->competitionsHome;
$competitionsGuest = $this->competitionsGuest;
// PUSH ONE TO OTHER!
return $competitionsHome->push($competitionsGuest);
}