Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
tbf.ro
/
app
/
Helpers
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
general.php
| Size :
3.71
KB
Copy
<?php use Illuminate\Support\Facades\Mail; use App\Mail\NewUserCreated; use App\Mail\NewInvoice; use App\Mail\NewContactInfo; use App\Mail\NewQuestionInfo; use App\Mail\NewProforma; use App\Mail\ContestRegistration; use App\User; function new_user_created_mail($user,$password){ $subject = "A fost creat un cont cu acest email pe tbf.ro"; $data = [ 'name' => $user->name.' '.$user->last_name, 'email' => $user->email, 'password' => $password, 'login_url' => config('app.url').'/login', ]; Mail::to($user->email)->queue(New NewUserCreated($subject, $data)); } function sendMailWithInvoice($invoice){ $subject = "[tbf.ro] Factura emisa"; $data = [ 'course_name' => $invoice->order->course->name, ]; if($invoice->currency == "EUR") { $pdf = PDF::loadView('invoices.download_eur', compact('invoice'))->stream(); }else{ $pdf = PDF::loadView('invoices.download', compact('invoice'))->stream(); } $filename = $invoice->series."-".$invoice->number.'.pdf'; Mail::to($invoice->order->email)->queue(New NewInvoice($subject, $data, $pdf, $filename)); } function new_contact_info($entity){ $subject = "Ati fost contactat pe tbf.ro"; $data = [ 'name' => $entity->name, 'email' => $entity->email, 'phone' => $entity->phone, 'message' => $entity->message, ]; Mail::to(config('app.call_center_email'))->queue(New NewContactInfo($subject, $data)); } function new_entry_into_contest($entity){ $subject = "ZIUA 5 - Inscriere concurs Master Plan 2020"; $data = [ 'name' => $entity->lastname, 'email' => $entity->email, 'registration_number' => $entity->id, ]; Mail::to($entity->email)->queue(New ContestRegistration($subject, $data)); } function new_question_course($entity){ $subject = "Ati fost intrebat pe tbf.ro"; $data = [ 'title' => $entity['title'], 'content' => $entity['content'], 'user' => $entity['user'], 'email' => $entity['email'], ]; Mail::to(config('app.call_center_email'))->queue(New NewQuestionInfo($subject, $data)); } function sendMailWithProforma($order,$amount){ $subject = "[tbf.ro] Proforma emisa"; $data = [ 'course_name' => $order->course->name, ]; if($order->country == "Romania") { $pdf = PDF::loadView('proforma.download', compact('order', 'amount'))->stream(); }else{ $pdf = PDF::loadView('proforma.download_eur', compact('order', 'amount'))->stream(); } $filename = "Proforma-".$order->id.'.pdf'; Mail::to($order->email)->queue(New NewProforma($subject, $data, $pdf, $filename)); } function send_push_notifications($title,$body,$data){ $tokens_users = User::whereNotNull('device_token')->distinct('device_token')->pluck('device_token')->toArray(); $url = "https://fcm.googleapis.com/fcm/send"; $serverKey = config('app.server_key'); $notification = array('title' => $title , 'text' => $body, 'sound' => 'default', 'badge' => '1'); $arrayToSend = array('registration_ids' => $tokens_users, 'notification' => $notification,'priority'=>'high', 'data' => $data); $json = json_encode($arrayToSend); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Authorization: key='. $serverKey; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); //Send the request $response = curl_exec($ch); //Close request if ($response === FALSE) { die('FCM Send Error: ' . curl_error($ch)); } curl_close($ch); }
Back