belongsTo(Company::class); } /** * Scope a query to only include roles for a specific company or system roles. */ public function scopeForCompany($query, $company_id) { return $query->where(function($q) use ($company_id) { $q->where('company_id', $company_id) ->orWhereNull('company_id'); }); } }