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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ReporteVentasMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $ventas;
|
||||
public $fromDate;
|
||||
public $toDate;
|
||||
public $email;
|
||||
|
||||
// Constructor recibe también el correo
|
||||
public function __construct(Collection $ventas, $fromDate, $toDate, $email)
|
||||
{
|
||||
$this->ventas = $ventas;
|
||||
$this->fromDate = $fromDate;
|
||||
$this->toDate = $toDate;
|
||||
$this->email = $email; // Guardamos el correo
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->subject('Reporte de Ventas')
|
||||
->to($this->email) // Enviamos el correo a la dirección proporcionada
|
||||
->view('emails.reporte-ventas');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class WelcomeUserMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public User $user;
|
||||
public string $password;
|
||||
public $loginUrl;
|
||||
|
||||
public function __construct(User $user, string $password)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->password = $password;
|
||||
$this->loginUrl = config('app.url') . '/admin/login'; // URL dinámica
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->subject('Bienvenido a la plataforma')
|
||||
->view('emails.welcome-user')
|
||||
->with([
|
||||
'name' => $this->user->name,
|
||||
'email' => $this->user->email,
|
||||
'password' => $this->password,
|
||||
'loginUrl' => $this->loginUrl,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user