JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr 'datetime', ]; public function creatorId() { if ($this->type == 'company' || $this->type == 'super admin') { return $this->id; } else { return $this->created_by; } } public function currentLanguage() { return $this->lang; } public function countCompany() { return User::where('type', '=', 'company')->where('created_by', '=', $this->creatorId())->count(); } public function countPaidCompany() { return User::where('type', '=', 'company')->whereNotIn( 'plan', [ 0, 1, ] )->where('created_by', '=', \Auth::user()->id)->count(); } public function totalBusiness($id) { return Business::where('created_by', '=', $id)->count(); } public function currentPlan() { return $this->hasOne('App\Models\Plan', 'id', 'plan'); } public function assignPlan($planID) { $plan = Plan::find($planID); if ($plan) { $this->plan = $plan->id; $business = Business::where('created_by', '=', \Auth::user()->id)->get(); if (strtolower($plan->duration) == 'month') { $this->plan_expire_date = Carbon::now()->addMonths(1)->isoFormat('YYYY-MM-DD'); } elseif (strtolower($plan->duration) == 'year') { $this->plan_expire_date = Carbon::now()->addYears(1)->isoFormat('YYYY-MM-DD'); } else if ($plan->duration == 'Lifetime') { $this->plan_expire_date = null; } $user = Auth::user(); if ($this->trial_expire_date != null) { $this->trial_expire_date = null; } if ($plan->business == -1) { foreach ($business as $b) { $b->status = 'active'; $b->save(); } } else { $businessCount = 0; foreach ($business as $b) { $businessCount++; if ($businessCount <= $plan->business) { $b->status = 'active'; ; $b->save(); } else { $b->status = 'lock'; $b->save(); } } } if (!empty($plan->module) || $plan->module=='') { $modules_array = explode(',', $plan->module); $currentActiveModules = userActiveModule::where('user_id', $user->id)->pluck('module')->toArray(); $user_module = $currentActiveModules; foreach ($modules_array as $module) { if (!in_array($module, $user_module)) { array_push($user_module, $module); } } $newModules = array_diff($user_module, $currentActiveModules); foreach ($newModules as $moduleName) { userActiveModule::create([ 'user_id' => $user->id, 'module' => $moduleName, 'active' => 1 ]); } } if($this->plan==1) { $this->active_module = null; } else { $this->active_module = implode(',', $modules_array); } $this->save(); return ['is_success' => true]; } else { return [ 'is_success' => false, 'error' => 'Plan is deleted.', ]; } } public function planPrice() { $user = \Auth::user(); if ($user->type == 'super admin') { $userId = $user->id; } else { $userId = $user->created_by; } return \DB::table('settings')->where('created_by', '=', $userId)->get()->pluck('value', 'name'); } public function dateFormat($date) { ; return date('d-m-Y', strtotime($date)); } public function getPlanThemes() { $plan = Plan::getPlansUser($this->plan); if ($plan) { $themes = $plan->themes; if (!empty($themes)) { return explode(',', $themes); } else { return []; } } else { return []; } } public function getTotalAppoinments() { return Appointment_deatail::where('created_by', $this->id)->count(); } public function getMaxBusiness() { $plan = Plan::find($this->plan); if ($plan) { return $plan->business; } else { return 0; } } public static function defaultEmail() { // Email Template $emailTemplate = [ 'Appointment Created', 'User Created', ]; foreach ($emailTemplate as $eTemp) { EmailTemplate::create( [ 'name' => $eTemp, 'from' => env('APP_NAME'), 'created_by' => 1, ] ); } $defaultTemplate = [ 'Appointment Created' => [ 'subject' => 'Appointment Created', 'lang' => [ 'ar' => '

مرحبا عزيزتي

قام {appointment_name} بحجز تعيين ل ـ {appointment_date} في{appointment_time}.

البريد الالكتروني : {appointment_email}

رقم التليفون : {appointment_phone}

يعتبر،

{app_url}

', 'da' => '

Hej, kære.

{ appointment_name } har bestilt en aftale for { appointment_date} kl. {appointment_time}.

E-mail: { appointment_email }

Telefonnummer: { appointment_phone }

Med venlig hilsen

{ app_name }.

', 'de' => '

Hallo Lieber,

{appointment_name} hat einen Termin für {appointment_date} gebucht um {appointment_time}.

E-Mail: {appointment_email}

Telefonnummer: {appointment_phone}

Betrachtet,

{app_name}.

', 'en' => '

Hi Dear,

{appointment_name} has booked an appointment for {appointment_date} at {appointment_time}.

Email: {appointment_email}

Phone Number: {appointment_phone}

Regards,

{app_name}.

', 'es' => '

Hola Querido,

{appointment_name} ha reservado una cita para {appointment_date}a las {appointment_time}.

Correo electrónico: {appointment_email}

Número de teléfono: {appointment_phone}

Considerando,

{app_name}.

', 'fr' => '

Salut, Chère,

{ appointment_name} a réservé un rendez-vous pour { appointment_date } à {appointment_time}.

Adresse électronique: {appointment_email}

Numéro de téléphone: { appointment_phone }

Regards,

{ app_name }.

', 'it' => '

Ciao Caro,

{appointment_name} ha prenotato un appuntamento per {appointment_date} a {appointment_time}.

Email: {appointment_email}

Numero di telefono: {appointment_phone}

Riguardo,

{app_name}.

', 'ja' => '

こんにちは、

{appointment_name} は {appointment_date} の {appointment_time} に予約を入れました。

メール: {appointment_email}

電話番号: {appointment_phone}

よろしくお願いします

{app_name}.

', 'nl' => '

Hallo, lieverd.

{ appointment_name } heeft een afspraak voor { appointment_date } geboekt Bij {appointment_time}.

E-mail: { appointment_email }

Telefoonnummer: { appointment_phone }

Betreft:

{ app_name }.

', 'pl' => '

Witam Szanowny Panie,

Użytkownik {appointment_name } zarezerwował termin dla {appointment_date } W {appointment_time}.

E-mail: {appointment_email }

Numer telefonu: {appointment_phone }

W odniesieniu do

{app_name }.

', 'ru' => '

Привет, дорогой.

Пользователь { appointment_name } забронировал назначение на { appointment_date } в {appointment_time}.

Электронная почта: { appointment_email }

Номер телефона: { appointment_phone }

С уважением,

{ app_name }.

', 'pt' => '

Oi Querida,

{appointment_name} marcou um compromisso para {appointment_date} no {appointment_time}.

E-mail: {appointment_email}

Número do Telefone: {appointment_phone}

Considera,

{app_name}.

', 'tr' => '

Merhaba canım,

{appointment_name} için randevu aldı {appointment_date} de {appointment_time}.

E-posta: {appointment_email}

Telefon numarası: {appointment_phone}

Saygılarımızla,

{app_name}.

', 'he' => '

הי יקירי

{appointment_name} קבע תור ל {appointment_date} ב-{appointment_time}.

דואר אלקטרוני: {appointment_email}

מספר טלפון: {appointment_phone}

ברכות

{app_name}.

', 'pt-br' => '

Oi querido

{appointment_name} marcou uma consulta para {appointment_date} em {appointment_time}.

Email: {appointment_email}

Telefone: {appointment_phone}

Relação,

{app_name}.

', 'zh' => '

嗨,亲爱的

{appointment_name} 已预约 {appointment_date} 在 {appointment_time}.

电子邮件: {appointment_email}

电话号码: {appointment_phone}

问候

{app_name}.

', ], ], 'User Created' => [ 'subject' => 'User Created', 'lang' => [ 'ar' => '

مرحبًا {user_name}

لتسجيل الدخول إلى تفاصيل حسابك ، ما عليك سوى النقر فوق Url أدناه

اسم المستخدم: {user_email}

كلمة المرور: {user_password}

{app_url}

شكرًا لك على الانضمام إلى فريقنا كـ {user_type}

', 'da' => '

Hej {user_name}

For at logge på dine kontooplysninger skal du blot klikke på URL nedenfor

brugernavn: {user_email}

adgangskode: {user_password}

{app_url}

Tak, fordi du sluttede dig til vores team som en {user_type}

', 'de' => '

Hallo, {user_name}

Um sich mit Ihren Kontodaten anzumelden, klicken Sie einfach unten auf die URL

Benutzername: {user_email}

Passwort: {user_password}

{app_url}

Vielen Dank, dass Sie unserem Team als {user_type} beigetreten sind

', 'en' => '

Hi {user_name}

To login to your account details simply click on Url Below

Username: {user_email}

Password: {user_password}

{app_url}

Thank you for joining our team as {user_type}

', 'es' => '

Hola, {nombre_de_usuario}

Para iniciar sesión en los detalles de su cuenta, simplemente haga clic en Url a continuación

nombre de usuario: {user_email}

contraseña: {usuario_contraseña}

{aplicación_url}

Gracias por unirte a nuestro equipo como {user_type}

', 'fr' => '

Bonjour, {user_name}

Pour vous connecter aux détails de votre compte, cliquez simplement sur Url ci-dessous

nom d\'utilisateur : {user_email}

mot de passe : {user_password}

{app_url}

Merci d\'avoir rejoint notre équipe en tant que {user_type}

', 'it' => '

Ciao, {nome_utente}

Per accedere ai dettagli del tuo account, fai semplicemente clic sull\'URL qui sotto

nome utente: {utente_email}

password: {user_password}

{app_url}

Grazie per esserti unito al nostro team come {user_type}

', 'ja' => '

こんにちは、{user_name}

アカウントの詳細にログインするには、下のURLをクリックしてください。

ユーザー名:{user_email}

パスワード:{user_password}

{app_url}

{user_type}として私たちのチームに参加していただきありがとうございます

', 'nl' => '

Hallo, {user_name}

Om in te loggen op uw accountgegevens, klikt u op onderstaande URL

gebruikersnaam: {user_email}

wachtwoord: {user_password}

{app_url}

Bedankt dat je lid bent geworden van ons team als {user_type}

', 'pl' => '

Cześć, {nazwa_użytkownika}

Aby zalogować się na swoje konto, po prostu kliknij poniższy adres URL

nazwa użytkownika: {user_email}

hasło: {user_password}

{app_url}

Dziękujemy za dołączenie do naszego zespołu jako {user_type}

', 'ru' => '

Привет, {имя_пользователя}

Чтобы войти в свою учетную запись, просто нажмите URL-адрес ниже

имя пользователя: {user_email}

пароль: {user_password}

{app_url}

Спасибо, что присоединились к нашей команде как {user_type}

', 'pt' => '

Olá, {user_name}

Para acessar os detalhes da sua conta, basta clicar no URL abaixo

nome de usuário: {user_email}

senha: {user_password}

{app_url}

Obrigado por se juntar à nossa equipa como {user_type}

', 'tr' => '

MERHABA {user_name}

Hesap ayrıntılarınıza giriş yapmak için aşağıdaki URL`ye tıklamanız yeterlidir

Kullanıcı adı: {user_email}

Şifre:: {user_password}

{app_url}

olarak ekibimize katıldığınız için teşekkür ederiz. {user_type}

', 'he' => '

היי {user_name}

כדי להתחבר לפרטי החשבון שלך פשוט לחץ על כתובת האתר למטה

שם משתמש: {user_email}

סיסמה: {user_password}

{app_url}

תודה שהצטרפת לצוות שלנו כ {user_type}

', 'pt-br' => '

Oi {user_name}

Para acessar os detalhes da sua conta, basta clicar em Url Abaixo

Nome de usuário: {user_email}

Senha: {user_password}

{app_url}

Obrigado por se juntar à nossa equipe como {user_type}

', 'zh' => '

你好 {user_name}

要登录您的帐户详细信息,只需单击下面的URL

用户名: {user_email}

密码: {user_password}

{app_url}

感谢您加入我们的团队 {user_type}

', ], ], ]; $email = EmailTemplate::all(); foreach ($email as $e) { foreach ($defaultTemplate[$e->name]['lang'] as $lang => $content) { EmailTemplateLang::create( [ 'parent_id' => $e->id, 'lang' => $lang, 'subject' => $defaultTemplate[$e->name]['subject'], 'content' => $content, ] ); } } $allEmail = EmailTemplate::all(); foreach ($allEmail as $email) { UserEmailTemplate::create( [ 'template_id' => $email->id, 'user_id' => 1, 'is_active' => 1, ] ); } } //Max User public function getMaxUser() { $plan = Plan::find($this->plan); if ($plan) { return $plan->max_users; } else { return 0; } } public function currentBusiness() { if (Auth::user()->type != 'super admin') { if ($this->current_business != 0) { $business = $this->getCurrentBusiness($this->current_business); if ($business) { return $business->title; } else { return false; } } else { if (request()->route()->getName() == 'appointments.index' || request()->route()->getName() == 'contacts.index') { return 'All'; } else { $business = Business::where('created_by', \Auth::user()->creatorId())->first(); if ($business) { return $business->title; } else { return false; } } } } } public static function getCurrentBusiness($current) { if (self::$businessCurrentDetail == null) { $business = Business::where('id', $current)->where('created_by', \Auth::user()->creatorId())->first(); self::$businessCurrentDetail = $business; } return self::$businessCurrentDetail; } }