/** * Allow for eager loading of related objects; * * @param mixed $relationships A string or array of strings representing the relationships to load. * @return mixed */ public function embed($relationships) { $relations = []; if (!is_array($relationships)) { $relations[] = $relationships; } else { $relations = $relationships; } foreach ($relations as $relation) { if (!in_array($relation, $this->embeddedData)) { $this->query->with($relation); } } return $this; }
/** * Process relationships * * @param query $query * @return query */ public function scopeRelationships($query) { return $query->with('slides', 'slides.images', 'slides.images', 'slides.images.imagecategories'); }
/** * Process relationships * * @param query $query * @return query */ public function scopeRelationships($query) { return $query->with('articles', 'pages', 'commentstatuses'); }
/** * Process relationships * * @param query $query * @return query */ public function scopeRelationships($query) { return $query->with('articles'); }
/** * Process relationships * * @param query $query * @return query */ public function scopeRelationships($query) { return $query->with('images', 'images.imagecategories', 'pagecategories', 'users'); }
/** * Process relationships * * @param query $query * @return query */ public function scopeRelationships($query) { return $query->with('comments'); }