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