芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/ModuleSetting.php
where('type', 'admin'); } elseif (in_array('client', user_roles())) { $module = $module->where('type', 'client'); } elseif (in_array('employee', user_roles())) { $module = $module->where('type', 'employee'); } $module = $module->where('status', 'active'); $module = $module->first(); return (bool)$module; } public static function addCompanyIdToNullModule($company, $module) { // This is done for existing module settings. This will update the company id with 1 // for existing module rather creating new module setting if ($company->id == 1) { ModuleSetting::withoutGlobalScope(CompanyScope::class)->where('module_name', $module) ->whereNull('company_id') ->update(['company_id' => $company->id]); } } public static function createRoleSettingEntry($module, $roles, $company) { self::addCompanyIdToNullModule($company, $module); // WORKSUITESAAS $moduleInPackage = collect(json_decode($company->package->module_in_package)); foreach ($roles as $role) { $data = ModuleSetting::withoutGlobalScope(CompanyScope::class) ->where('module_name', $module) ->where('type', $role) ->where('company_id', $company->id) ->first(); if (!$data) { ModuleSetting::create([ 'module_name' => $module, 'type' => $role, 'company_id' => $company->id, 'status' => $moduleInPackage->contains($module) ? 'active' : 'deactive', 'is_allowed' => $moduleInPackage->contains($module) ? 1 : 0, ]); } } PermissionRole::insertModuleRolePermission($module, $company->id); } }