Add scopes for components
This commit is contained in:
@@ -133,6 +133,30 @@ class Component extends Model implements HasPresenter
|
||||
return $query->where('status', '<>', $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all components which are enabled.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeEnabled(Builder $query)
|
||||
{
|
||||
return $query->where('enabled', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all components which are disabled.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeDisabled(Builder $query)
|
||||
{
|
||||
return $query->where('enabled', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the human readable version of the status.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user