From b96f14eac000c46e0b43a1fa29ebb0fcf34d1191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 8 Dec 2020 18:47:32 +0300 Subject: [PATCH] Added allCompanies scope.. --- app/Abstracts/Model.php | 12 ++++++++++++ app/Models/Common/Recurring.php | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Abstracts/Model.php b/app/Abstracts/Model.php index 460de969c..5c1a25807 100644 --- a/app/Abstracts/Model.php +++ b/app/Abstracts/Model.php @@ -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. * diff --git a/app/Models/Common/Recurring.php b/app/Models/Common/Recurring.php index a1a379c49..8e878050b 100644 --- a/app/Models/Common/Recurring.php +++ b/app/Models/Common/Recurring.php @@ -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'); - } }