/
home
/
henzagold
/
server
/
app
/
Console
/
Commands
/
File Upload :
llllll
Current File: /home/henzagold/server/app/Console/Commands/SmsWalletCommand.php
<?php namespace App\Console\Commands; use App\Models\SingleCustomer; use App\Models\Sms; use Illuminate\Console\Command; use Rooyesh\Wallet\models\Wallet; class SmsWalletCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'wallet: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() { $wallets = Wallet::whereDate('sms_at',now()->subMonth(3)->format('Y-m-d')) ->get(); foreach ($wallets as $wallet){ if ($wallet->gold > 0 || $wallet->credit > 0){ $customer = SingleCustomer::findOrFail($wallet->owner); Sms::Send($customer->phone,'هنزا'); $wallet->sent = 1; }else{ $wallet->sent = 0; } $wallet->sms_at = now(); $wallet->save(); } } }
Copyright ©2k19 -
Hexid
|
Tex7ure