1
After the creation of cron (code below) is made a scan in the database behind changed data. I have to send an email with this data. How can I do that ???
Code of the cron:
<?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');
}
}
Error showing: [Invalidargumentexception] Please provide a Valid cache path.
– alexjosesilva
@alexjosesilva depends on where this is coming from.
– novic
error already fixed with command: php Artisan view:clear
– alexjosesilva
now the error is another: [Errorexception] Undefined Property: stdClass::$Description (View: /var/www/html/api-Finance ira/Resources/views/corpoEmail.blade.php)
– alexjosesilva
correct the error in the email body: r->Description does not exist in the database array.
– alexjosesilva
I switched to data r->id, r->creat_at
– alexjosesilva
New error: [Swift_transportexception] Expected Response code 250 but got code "530", with message "530 5.7.1 Auth entication required "
– alexjosesilva
The last error is setting email @alexjosesilva just missing this... try to configure it correctly
– novic
I asked a question just for this: https://answall.com/questions/249824/erro-laravel-sendemail
– alexjosesilva