/**
  * 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;
 }
Beispiel #2
0
 /**
  * Process relationships
  * 
  * @param query $query
  * @return query
  */
 public function scopeRelationships($query)
 {
     return $query->with('slides', 'slides.images', 'slides.images', 'slides.images.imagecategories');
 }
Beispiel #3
0
 /**
  * Process relationships
  * 
  * @param query $query
  * @return query
  */
 public function scopeRelationships($query)
 {
     return $query->with('articles', 'pages', 'commentstatuses');
 }
Beispiel #4
0
 /**
  * Process relationships
  * 
  * @param query $query
  * @return query
  */
 public function scopeRelationships($query)
 {
     return $query->with('articles');
 }
Beispiel #5
0
 /**
  * Process relationships
  * 
  * @param query $query
  * @return query
  */
 public function scopeRelationships($query)
 {
     return $query->with('images', 'images.imagecategories', 'pagecategories', 'users');
 }
Beispiel #6
0
 /**
  * Process relationships
  * 
  * @param query $query
  * @return query
  */
 public function scopeRelationships($query)
 {
     return $query->with('comments');
 }