<?php
namespace App\Mail;
use App\Models\User;
use App\Models\WorkshopServiceProposal;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Str;
class WorkshopProposalMail extends Mailable implements ShouldQueue {
use Queueable, SerializesModels;
public $workshopProposal;
public $clienteName;
public $clienteId;
public $tallerName;
public $token;
public function __construct(WorkshopServiceProposal $workshopProposal, $clienteName, $tallerName, $clienteId) {
$this->workshopProposal = $workshopProposal;
$this->clienteName = $clienteName;
$this->tallerName = $tallerName;
$this->clienteId = $clienteId;
$this->token = Str::random(60);
$usuario = User::find($clienteId);
$usuario->updateOrCreate(['id' => $clienteId], ['login_token' => $this->token]);
}
public function build() {
return $this->view('emails.workshop_proposal')->with('token', $this->token);
}
}
|