芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/GlobalSetting.php
'DD-MM-YYYY', 'm-d-Y' => 'MM-DD-YYYY', 'Y-m-d' => 'YYYY-MM-DD', 'd.m.Y' => 'DD.MM.YYYY', 'm.d.Y' => 'MM.DD.YYYY', 'Y.m.d' => 'YYYY.MM.DD', 'd/m/Y' => 'DD/MM/YYYY', 'm/d/Y' => 'MM/DD/YYYY', 'Y/m/d' => 'YYYY/MM/DD', 'd/M/Y' => 'DD/MMM/YYYY', 'd.M.Y' => 'DD.MMM.YYYY', 'd-M-Y' => 'DD-MMM-YYYY', 'd M Y' => 'DD MMM YYYY', 'd F, Y' => 'DD MMMM, YYYY', 'D/M/Y' => 'ddd/MMM/YYYY', 'D.M.Y' => 'ddd.MMM.YYYY', 'D-M-Y' => 'ddd-MMM-YYYY', 'D M Y' => 'ddd MMM YYYY', 'd D M Y' => 'DD ddd MMM YYYY', 'D d M Y' => 'ddd DD MMM YYYY', 'dS M Y' => 'Do MMM YYYY', ]; const SELECT2_SHOW_COUNT = 20; public function currency(): BelongsTo { // WORKSUITE SAAS return $this->belongsTo(GlobalCurrency::class, 'currency_id'); if (isWorksuite()) { return $this->belongsTo(Currency::class, 'currency_id'); } } public function getLogoUrlAttribute() { if (user()) { if (user()->dark_theme) { return $this->defaultLogo(); } } if (company() && company()->auth_theme == 'dark') { return $this->defaultLogo(); } if (is_null($this->light_logo)) { return asset('img/worksuite-logo.png'); } return asset_url_local_s3('app-logo/' . $this->light_logo); } public function defaultLogo() { if (is_null($this->logo)) { return asset('img/worksuite-logo.png'); } return asset_url_local_s3('app-logo/' . $this->logo); } public function getLightLogoUrlAttribute() { if (is_null($this->light_logo)) { return asset('img/worksuite-logo.png'); } return asset_url_local_s3('app-logo/' . $this->light_logo); } public function getDarkLogoUrlAttribute() { if (is_null($this->logo)) { return asset('img/worksuite-logo.png'); } return asset_url_local_s3('app-logo/' . $this->logo); } public function getLoginBackgroundUrlAttribute() { if (is_null($this->login_background) || $this->login_background == 'login-background.jpg') { return null; } return asset_url_local_s3('login-background/' . $this->login_background); } public function maskedDefaultLogo(): Attribute { return Attribute::make( get: function () { if (is_null($this->logo)) { return asset('img/worksuite-logo.png'); } return $this->generateMaskedImageAppUrl('app-logo/' . $this->logo); }, ); } public function maskedLogoUrl(): Attribute { return Attribute::make( get: function () { if (user()) { if (user()->dark_theme) { return $this->masked_default_logo; } } if (company() && company()->auth_theme == 'dark') { return $this->masked_default_logo; } if (is_null($this->light_logo)) { return asset('img/worksuite-logo.png'); } return $this->generateMaskedImageAppUrl('app-logo/' . $this->light_logo); }, ); } public function maskedLightLogoUrl(): Attribute { return Attribute::make( get: function () { if (is_null($this->light_logo)) { return asset('img/worksuite-logo.png'); } return $this->generateMaskedImageAppUrl('app-logo/' . $this->light_logo); }, ); } public function maskedDarkLogoUrl(): Attribute { return Attribute::make( get: function () { if (is_null($this->logo)) { return asset('img/worksuite-logo.png'); } return $this->generateMaskedImageAppUrl('app-logo/' . $this->logo); }, ); } public function maskedLoginBackgroundUrl(): Attribute { return Attribute::make( get: function () { if (is_null($this->login_background) || $this->login_background == 'login-background.jpg') { return null; } return $this->generateMaskedImageAppUrl('login-background/' . $this->login_background); }, ); } public function maskedFaviconUrl(): Attribute { return Attribute::make( get: function () { if (is_null($this->favicon)) { return asset('favicon.png'); } return $this->generateMaskedImageAppUrl('favicon/' . $this->favicon); }, ); } public function maskedLogoFrontUrl(): Attribute { return Attribute::make( get: function () { if (is_null($this->logo_front)) { if (is_null($this->logo)) { return asset('front/img/worksuite-logo.png'); } return $this->logo_url; } return $this->generateMaskedImageAppUrl('app-logo/' . $this->logo_front); }, ); } public function getShowPublicMessageAttribute() { if (str_contains(request()->url(), request()->getHost() . '/public')) { return true; } return false; } public function getMomentDateFormatAttribute() { return isset($this->date_format) ? self::DATE_FORMATS[$this->date_format] : null; } public function getFaviconUrlAttribute() { if (is_null($this->favicon)) { return asset('favicon.png'); } return asset_url_local_s3('favicon/' . $this->favicon); } public function getLogoFrontUrlAttribute() { if (is_null($this->logo_front)) { if (is_null($this->logo)) { return asset('front/img/worksuite-logo.png'); } return $this->logo_url; } return asset_url_local_s3('app-logo/' . $this->logo_front); } public static function checkListCompleted() { $checkListCompleted = 2; // Installation and Admin Account setup if (smtp_setting()->mail_from_email != 'from@email.com') { $checkListCompleted++; } if (!is_null(global_setting()->last_cron_run)) { $checkListCompleted++; } if (!is_null(global_setting()->logo)) { $checkListCompleted++; } if (!is_null(global_setting()->favicon)) { $checkListCompleted++; } return $checkListCompleted; } public static function getMonthsOfYear($full = 'F') { $months = []; for ($monthNumber = 1; $monthNumber <= Carbon::MONTHS_PER_YEAR; $monthNumber++) { $monthName = Carbon::create(null, $monthNumber)->translatedFormat($full); $months[] = $monthName; } return $months; } public static function getDaysOfWeek($full = 'D') { $days = []; for ($dayNumber = 0; $dayNumber < Carbon::DAYS_PER_WEEK; $dayNumber++) { $dayName = Carbon::now()->startOfWeek(0)->addDays($dayNumber)->translatedFormat($full); $days[] = $dayName; } return $days; } public static function validateAdmin() { // WORKSUITESAAS if (isWorksuiteSaas()) { abort_403(!user()->is_superadmin); } else { abort_403(!in_array('admin', user_roles())); } } public static function validateSuperAdmin($permission = null) { // WORKSUITESAAS if (isWorksuiteSaas() && user()->is_superadmin) { if (!is_null($permission)) { return (user()->permission($permission) !== 'all') ? true : false; } return false; } return !in_array('admin', user_roles()) ? true : false; } }