Add email template..
This commit is contained in:
		
							
								
								
									
										56
									
								
								app/Listeners/Update/V21/Version2118.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								app/Listeners/Update/V21/Version2118.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Listeners\Update\V21; | ||||
|  | ||||
| use App\Abstracts\Listeners\Update as Listener; | ||||
| use App\Events\Install\UpdateFinished as Event; | ||||
| use App\Models\Common\Company; | ||||
| use App\Models\Common\EmailTemplate; | ||||
| use Illuminate\Support\Facades\Artisan; | ||||
|  | ||||
| class Version2118 extends Listener | ||||
| { | ||||
|     const ALIAS = 'core'; | ||||
|  | ||||
|     const VERSION = '2.1.18'; | ||||
|  | ||||
|     /** | ||||
|      * Handle the event. | ||||
|      * | ||||
|      * @param  $event | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function handle(Event $event) | ||||
|     { | ||||
|         if ($this->skipThisUpdate($event)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $this->updateEmailTemplate(); | ||||
|  | ||||
|         Artisan::call('migrate', ['--force' => true]); | ||||
|     } | ||||
|  | ||||
|     protected function updateCompanies() | ||||
|     { | ||||
|         $company_id = company_id(); | ||||
|  | ||||
|         $companies = Company::cursor(); | ||||
|  | ||||
|         foreach ($companies as $company) { | ||||
|             $company->makeCurrent(); | ||||
|  | ||||
|             EmailTemplate::create([ | ||||
|                 'company_id' => $company->id, | ||||
|                 'alias' => 'revenue_new_customer', | ||||
|                 'class' => 'App\Notifications\Sale\Revenue', | ||||
|                 'name' => 'settings.email.templates.revenue_new_customer', | ||||
|                 'subject' => trans('email_templates.revenue_new_customer.subject'), | ||||
|                 'body' => trans('email_templates.revenue_new_customer.body'), | ||||
|             ]); | ||||
|         } | ||||
|  | ||||
|         company($company_id)->makeCurrent(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user