Add meta relation to all models
This commit is contained in:
+20
-10
@@ -131,6 +131,26 @@ class Schedule extends Model implements HasPresenter
|
||||
*/
|
||||
protected $with = ['components'];
|
||||
|
||||
/**
|
||||
* Get the components relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function components()
|
||||
{
|
||||
return $this->hasMany(ScheduleComponent::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the meta relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
*/
|
||||
public function meta()
|
||||
{
|
||||
return $this->morphMany(Meta::class, 'meta');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scopes schedules to those in the future.
|
||||
*
|
||||
@@ -155,16 +175,6 @@ class Schedule extends Model implements HasPresenter
|
||||
return $query->where('status', '<', self::COMPLETE)->where('scheduled_at', '<=', Carbon::now());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the components relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function components()
|
||||
{
|
||||
return $this->hasMany(ScheduleComponent::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the presenter class.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user