aggiornamento log

This commit is contained in:
paoloar77
2024-06-19 18:40:07 +02:00
parent 80c6c7518a
commit d570b477a7
4 changed files with 28 additions and 29 deletions

View File

@@ -14,11 +14,14 @@ class ProductLogger
public $logs = [];
protected $settingOra = null;
protected $channel = "";
protected $aggiornato = false;
public function __construct($settingOra)
public function __construct($settingOra, $channel)
{
$this->settingOra = $settingOra;
$this->channel = $channel;
$this->init();
}
@@ -44,7 +47,7 @@ class ProductLogger
$this->settingOra = $newOra;
}
public function setLogandSendEmail()
public function setLogandSendEmail($descr)
{
if (is_object($this->settingOra) && method_exists($this->settingOra, 'save')) {
$ora_update = Carbon::now();
@@ -56,17 +59,11 @@ class ProductLogger
}
if ($this->aggiornato) {
Log::channel('updateproducts')->notice($this->concatenateLogs());
Log::channel($this->channel)->notice($this->concatenateLogs());
Mail::raw($this->concatenateLogs(), function ($message) {
if (!$this->settingOra) {
$titolo = "Inserim. prodotto:";
} else {
$titolo = "Inserim. nuovi prodotti";
}
Mail::raw($this->concatenateLogs(), function ($message) use ($descr) {
$message->to(Mylog::getEmail());
$message->subject(Mylog::getSubjectEmail($titolo));
$message->subject(Mylog::getSubjectEmail($descr));
});
}
}