File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/app/Mail/SendProgramAdminMail.php
<?php
namespace App\Mail;
use App\Komma\Locations\Models\Location;
use App\Komma\Orders\Models\Order;
use App\Komma\Orders\OrderService;
use App\Komma\ShoppingCart\Interfaces\ShoppingCartInterface;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class SendProgramAdminMail extends Mailable
{
use Queueable, SerializesModels;
/** @var string */
private $mailTo;
/** @var string */
private $mailedTo;
/** @var Order */
private $order;
/** @var Location */
private $location;
/** @var Location */
private $link;
public bool $savedToTeamleader;
public array $messages;
/**
* SendProgramMail constructor.
*
* @param ShoppingCartInterface $cart
* @param string $mailedTo
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function __construct(ShoppingCartInterface $cart, string $mailedTo, string $cartGenerationLink, bool $savedToTeamleader, array $messages)
{
/** @var OrderService $orderService */
$orderService = app()->make(OrderService::class);
$this->order = $orderService->createFakeOrderFromCart($cart);
$this->location = $cart->getLocation();
$this->link = $cartGenerationLink;
$this->savedToTeamleader = $savedToTeamleader;
$this->messages = $messages;
$this->mailTo = site_config('mailTo');
$this->mailedTo = $mailedTo;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('emails.admin.sendProgram')
->to($this->mailTo)
->subject('Gegenereerde offerte | Website')
->with([
'mailedTo' => $this->mailedTo,
'order' => $this->order,
'cartLink' => $this->link,
'location' => $this->location,
]);
}
}