/
home
/
maktab
/
server
/
app
/
Console
/
Commands
/
File Upload :
llllll
Current File: /home/maktab/server/app/Console/Commands/BirthdayModirCommand.php
<?php namespace App\Console\Commands; use App\Models\Cloony; use App\Models\Maktab; use App\Models\Sms; use App\Models\User; use Illuminate\Console\Command; class BirthdayModirCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'master:birthday'; /** * 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() { $users = User::whereDay('birth_day',now()->addDays(3)->format('d')) ->whereMonth('birth_day',now()->addDays(3)->format('m')) ->where('type',3) ->get(); foreach ($users as $user){ $maktab = Maktab::findOrFail($user->maktab_id); $colony = Cloony::findOrFail($maktab->cloony_id); $modir = User::findOrFail($colony->master_id); $birthday = verta($user->birth_day)->format('Y/n/j'); Sms::Send($modir->mobile , 'مکتب|یادآوری'."\n". 'تولد آقای '.$user->name.' در تاریخ '.$birthday."\n" ); } } }
Copyright ©2k19 -
Hexid
|
Tex7ure