Added allCompanies scope..
This commit is contained in:
parent
4c9234cba6
commit
b96f14eac0
@ -44,6 +44,18 @@ abstract class Model extends Eloquent
|
||||
return $this->belongsTo('App\Models\Common\Company');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to only include company data.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeAllCompanies($query)
|
||||
{
|
||||
return $query->withoutGlobalScope(Company::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to only include company data.
|
||||
*
|
||||
|
@ -26,16 +26,4 @@ class Recurring extends Model
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to get all rows filtered, sorted and paginated.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeAllCompanies($query)
|
||||
{
|
||||
return $query->where('company_id', '<>', '0');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user