After the creation of cron (code below) a scan is made in the database behind altered data. I have to send an email with this data. How can I do this ???
cron code:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class envioEmailBIcron extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'envioEmailBI:cron';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command Email';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Pegar os dados no banco
$sql = ' select * from payments as P, receipts as R ';
$sql .= ' where P.created_at < CURRENT_DATE AND P.updated_at < CURRENT_DATE ';
$sql .= ' AND R.created_at < CURRENT_DATE AND R.updated_at < CURRENT_DATE';
//pega os dados no banco
$query = \DB::select($sql);
// executando as funções de envio de e-mail
$this->info('Example Cron comando rodando com êxito');
}
}