where([ 'company_id' => 0, 'global' => 1, 'status' => 1, ])->orWhere([ 'company_id' => Auth::user()->company_id, 'status' => 1 ])->find($namingRuleId); if (! $namingRule) { throw new \Exception("The current naming rule has no permission to use"); } } }