aggiornamento log
This commit is contained in:
@@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user