app/Console/Commands/PendingClients.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $from = Carbon::today()->toDateString();
        $to = Carbon::tomorrow()->toDateString();
        $all_entries = Reminder::whereBetween('end_date', [$from, $to])->where('status', 1)->get();
        foreach ($all_entries as $entry) {
            $data['text'] = $entry->message;
            $number_array = [];
            $emails = json_decode($entry->email);
            foreach ($emails as $email) {
                $data['email'] = $email;
                $this->sendEmail($data);
            }
            $phones = json_decode($entry->mobile);
            foreach ($phones as $phone) {
                array_push($number_array, $phone);
            }
            $number_array = implode(",", $number_array);
            $this->sendSMS($data['text'], $number_array);
        }
    }
public function handle ( ) { $ from = Carbon :: today ( ) -> toDateString ( ) ; $ to = Carbon :: tomorrow ( ) -> toDateString ( ) ; $ all_entries = Reminder :: whereBetween ( 'end_date' , [ $ from , $ to ] ) -> where ( 'status' , 1 ) -> get ( ) ; foreach ( $ all_entries as $ entry ) { $ data [ 'text' ] = $ entry -> message ; $ number_array = [ ] ; $ emails = json_decode ( $ entry -> email ) ; foreach ( $ emails as $ email ) { $ data [ 'email' ] = $ email ; $ this -> sendEmail ( $ data ) ; } $ phones = json_decode ( $ entry -> mobile ) ; foreach ( $ phones as $ phone ) { array_push ( $ number_array , $ phone ) ; } $ number_array = implode ( " , " , $ number_array ) ; $ this -> sendSMS ( $ data [ 'text' ] , $ number_array ) ; } }
Execute the console command.
Execute the console command .
// get all the clients that are scheduled to be sent an email and an sms today and tomorrow: