Files
api-extranetwork/app/Core/Mail/OfferPreConfirmPropertyMail.php
ExtraNetwork e5c4b6aa13 first commit
2026-05-12 17:04:54 +03:00

92 lines
3.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Core\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
class OfferPreConfirmPropertyMail extends Mailable
{
use Queueable, SerializesModels;
public $tries = 5;
public $timeout = 30;
protected $param;
public function __construct($param)
{
$this->param = $param;
}
public function build()
{
try {
$params = $this->param;
$propertyService = App::make("App\Core\Service\OfferService");
$requestParams = [
'offer_id' => fillOnUndefined($params, 'offer_id'),
'property_id' => fillOnUndefined($params, 'property_id'),
];
$offerDetail = $propertyService->findOffer($requestParams);
$offerDetail = fillOnUndefined($offerDetail, 'data');
app('translator')->setLocale($offerDetail["language"]);
$mailSenderAddress = Config::get('app.mailSenderAddress');
$mailParams['to'] = [];
$mailParams['to'] = $offerDetail['create_user']['email'];
$mailParams['bcc'] = [];
$mailParams['bcc'][] = Config::get('app.logMailAddress');
$mailParams['property_name'] = $offerDetail['property']['name'];
$mailParams['url'] = Config::get('app.client_server').'/offer/'.$offerDetail['offer_code'];
$mailParams['logo'] = Config::get('app.webUrl').'/assets/img/logo/mini-logo.png';
if(isset($offerDetail['property_brand']['logoUrl'])) {
$mailParams['logo'] = $offerDetail['property_brand']['logoUrl'];
}
$description = [];
//$description[] = 'Misafir, <b>'.$offerDetail['ticket_code'].'</b> kodlu teklifi onaylamıştır.';
$description[] = __('api-mailing-offer_preconfirm_property_mail-description-one', ['code' => $offerDetail['ticket_code']]);
//$description[] = 'Teklif türü otel onaylı olduğu için, tesis onayı beklenmektedir. Tesis onayını Extranetwork üzerinden verebilirsiniz.';
$description[] = __('api-mailing-offer_preconfirm_property_mail-description-two');
$description = implode('<br><br>', $description);
/*echo view('emails.offerPreConfirmPropertyMail', compact('mailParams', 'description'));
die();*/
return $this->from($mailSenderAddress, 'Extranetwork - ' . $mailParams['property_name'])
->view('emails.offerPreConfirmPropertyMail', compact('mailParams', 'description'))
->to($mailParams['to'])
->bcc($mailParams['bcc'])
//->subject($offerDetail['ticket_code'].' Kodlu Teklif Misafir Onayı')
->subject(__('api-mailing-offer_preconfirm_property_mail-title', ['code' => $offerDetail['ticket_code']]))
->with(['message' => $this]);
} catch (Exception $e) {
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
Log::error($message);
return output(['status' => -1, 'message' => $e->getMessage()]);
}
}
}