61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\ServicioDet;
|
|
use DB;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Log;
|
|
|
|
class SolicitudServicioTerminadoNew extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($servicio_enc_id, $servicio_det_id, $pdf_nombre)
|
|
{
|
|
$this->servicio_enc_id = $servicio_enc_id;
|
|
$this->servicio_det_id = $servicio_det_id;
|
|
$this->pdf_nombre = $pdf_nombre;
|
|
}
|
|
|
|
/**
|
|
* Build the message.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function build()
|
|
{
|
|
$campos = [
|
|
'servicios_enc.id as folio',
|
|
'clientes_domicilios.nombre_responsable_sucursal as contacto',
|
|
'cat_servicios.nombre as servicio',
|
|
];
|
|
|
|
$servicio = ServicioDet::select($campos)
|
|
->join('servicios_enc', 'servicios_det.servicio_enc_id', '=', 'servicios_enc.id')
|
|
->join('clientes', 'servicios_enc.cliente_id', '=', 'clientes.id')
|
|
->join('clientes_domicilios', 'servicios_enc.cliente_domicilio_id', '=', 'clientes_domicilios.id')
|
|
->join('cat_servicios', 'servicios_det.servicio_id', '=', 'cat_servicios.id')
|
|
->where('servicios_det.id', $this->servicio_det_id)
|
|
->where('servicios_det.servicio_enc_id', $this->servicio_enc_id)
|
|
->firstOrFail();
|
|
|
|
$info = [
|
|
'contacto' => $servicio->contacto,
|
|
'folio' => $servicio->folio,
|
|
'servicio' => $servicio->servicio
|
|
];
|
|
|
|
return $this->view('email.emailSolicitudServicioTerminado', compact('info'))
|
|
->subject('Servicio terminado.')
|
|
->attach(storage_path('app/public/servicios/recibos_pdf/' . $this->pdf_nombre));
|
|
}
|
|
}
|