up
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class AlertaStockMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $productosStockMinimo;
|
||||
public $productosStockMaximo;
|
||||
public $email;
|
||||
|
||||
public function __construct(Collection $productosStockMinimo, Collection $productosStockMaximo, $email)
|
||||
{
|
||||
$this->productosStockMinimo = $productosStockMinimo;
|
||||
$this->productosStockMaximo = $productosStockMaximo;
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
$subject = 'Alerta de Stock - ';
|
||||
|
||||
if ($this->productosStockMinimo->isNotEmpty() && $this->productosStockMaximo->isNotEmpty()) {
|
||||
$subject .= 'Stock Mínimo y Máximo';
|
||||
} elseif ($this->productosStockMinimo->isNotEmpty()) {
|
||||
$subject .= 'Stock Mínimo Alcanzado';
|
||||
} else {
|
||||
$subject .= 'Stock Máximo Excedido';
|
||||
}
|
||||
|
||||
return $this->subject($subject)
|
||||
->to($this->email)
|
||||
->view('emails.alerta-stock');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user