/
home
/
old_henza
/
server
/
app
/
Console
/
Commands
/
File Upload :
llllll
Current File: //home/old_henza/server/app/Console/Commands/birthdayCommand.php
<?php namespace App\Console\Commands; use App\Models\ConfigStatic; use App\Models\SingleCustomer; use App\Models\Sms; use Illuminate\Console\Command; use Rooyesh\Wallet\interfaces\TransactionInterface; use Rooyesh\Wallet\interfaces\WalletInterface; use App\Http\Controllers\Controller as controller; class birthdayCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'birthday:sms'; /** * The console command description. * * @var string */ protected $description = 'Command description'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $value = ConfigStatic::where('key','birthday_credit')->first()->val; $expire = ConfigStatic::where('key','birthday_expire')->first()->val; $customers = SingleCustomer::whereDay('birth_day',now()->format('d')) ->whereMonth('birth_day', now()->format('m')) ->get(); foreach ($customers as $cu){ Sms::Send($cu->phone , 'سلام'."\n" .$cu->fname.' '.$cu->lname.' گرامی '."\n" .'زادروزتان مبارک'."\n" .'گالري طلاي هنزا برای هديه تولد شما، بن خرید '.$value.' تومانی در نظر گرفته است.'."\n" .'با ارزوی بهترین ها برای شما'."\n" .'بازدید و سفارش محصولات www.henzagold.com'."\n" .'هنزا لحظات درخشان زندگی شما' ); $wallet_interface = new WalletInterface($cu->id, 1); $transaction = new TransactionInterface($wallet_interface, $_inp = [ "value" => $value, "note"=>"for birthday", 'expire_at'=>now()->addDays($expire), ], 2, true); } } }
Copyright ©2k19 -
Hexid
|
Tex7ure