/
home
/
henzagold
/
server
/
app
/
Jobs
/
File Upload :
llllll
Current File: /home/henzagold/server/app/Jobs/PromotionAfterCreate.php
<?php namespace App\Jobs; use App\Models\Major\Promotion; use App\Models\Major\PromotionItem; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class PromotionAfterCreate implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public $customer_id; /** * Create a new job instance. * * @return void */ public function __construct($customer_id) { $this->customer_id = $customer_id; } /** * Execute the job. * * @return void */ public function handle() { $p = Promotion::create([ 'title'=>'ویژه مشتریان جدید ', 'description'=>'ویژه مشتریان جدید ', 'start_at'=>now(), 'end_at'=>now()->addDays(5), 'type'=>3, 'type_customer'=>2, 'discount_percent'=>1, 'is_active'=>1, 'use_only'=>1, 'show'=>1, ]); PromotionItem::create([ 'promotion_id' => $p->id, 'item_id' => $this->customer_id, ]); } }
Copyright ©2k19 -
Hexid
|
Tex7ure