File: /var/www/vhost/disk-apps/qas.sports-crowd.com/app/Mail/TicketPurchaseMail.php
<?php
namespace App\Mail;
use App\Core\Parameter\Application\ParameterService;
use App\Core\Ticket\Application\TicketService;
use App\Http\Controllers\UtilController;
use App\Services\TicketParametersService;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Crypt;
class TicketPurchaseMail extends Mailable
{
use Queueable, SerializesModels;
public $user_data;
public $user;
public $link;
public $shortLink;
public $title;
public $invoice_link;
public $view;
public $event;
public $appStoreUrl;
public $playStoreUrl;
private $ticketService;
private $ticketParametersService;
private $parameterService;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($user_data, $code_ticket)
{
$this->title = 'Boletas ' . config('app.name');
$this->ticketService = new TicketService();
$this->ticketParametersService = new TicketParametersService();
$this->parameterService = new ParameterService();
if ($this->ticketParametersService->isStaticQRType()) {
$this->link = config('app.url') . '/download_ticket_for_user/' . Crypt::encryptString($code_ticket);
$util = new UtilController;
$this->shortLink = $util->shorterUrl($this->link);
$this->invoice_link = $this->ticketService->getInvoiceLink($code_ticket);
$this->view = 'mails.buyTickets';
} else {
$this->user = $user_data;
$this->event = $this->ticketService->getTicketByCodeTicket($code_ticket)->match_event;
$this->appStoreUrl = $this->parameterService->appStoreUrl();
$this->playStoreUrl = $this->parameterService->playStoreUrl();
$this->view = 'mails.ticket.buy-ticket';
}
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from('noreply@sports-crowd.com', 'Sports Crowd')->subject($this->title)->view($this->view);
}
}