From 078750726fd5f1f2d8ea35e25b366a95d15d7075 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 26 Nov 2015 14:11:56 -0800 Subject: [PATCH] Set default value for company_id to fix seeder --- app/models/Company.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/Company.php b/app/models/Company.php index 9c844a9b1c..8efb542052 100644 --- a/app/models/Company.php +++ b/app/models/Company.php @@ -18,7 +18,11 @@ final class Company extends Elegant private static function scopeCompanyablesDirectly($query, $column = 'company_id') { - $company_id = Sentry::getUser()->company_id; + if (Sentry::getUser()) { + $company_id = Sentry::getUser()->company_id; + } else { + $company_id = NULL; + } if ($company_id == NULL) { return $query; } else { return $query->where($column, '=', $company_id); }