403Webshell
Server IP : 3.138.164.131  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux ns1.techtime.me 4.18.0-147.8.1.el8.lve.1.x86_64 #1 SMP Mon Jun 29 09:55:57 EDT 2020 x86_64
User : injazaat ( 1471)
PHP Version : 8.1.20
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/injazaat/public_html/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/injazaat/public_html/app/Http/Controllers/LinksController.php
<?php

namespace App\Http\Controllers;

use App\Models\Links;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Validator;
Use RealRashid\SweetAlert\Facades\Alert;

class LinksController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $data['links'] = Links::all();
        return view('admin.links_managment.index', $data);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        // $data['links'] = Links::all();

        return view('/admin/links_managment/create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validitor = Validator::make($request->all(), [
            'name' => 'required|min:2|max:255',
            'external_link' => 'max:255',
            'name_ar' => 'required|min:2|max:255',
            'external_link_ar' => 'max:255',
            'link_priority' => 'max:30|integer|nullable|unique:links'

        ]);


        if ($validitor->fails()) {
            alert()->error('Opps...','There is some issue with input');

            return Redirect::route('add-links')->withErrors($validitor)->withInput();
        }


        $links = new Links();





        $links->name = $request->name;
        $links->external_link = $request->external_link;
        $links->name_ar = $request->name_ar;
        $links->external_link_ar = $request->external_link_ar;
        $links->link_priority = $request->link_priority;

        $links->save();
        Alert::success('Success ', 'Links has been Created');

        return Redirect::route('show-links');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Links  $links
     * @return \Illuminate\Http\Response
     */
    public function show(Links $links)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Links  $links
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {

        $data['links'] = Links::find($id); // Eloquent
        return view('/admin/links_managment.update', $data);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Links  $links
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $validitor = Validator::make($request->all(), [
            'name' => 'required|min:2|max:255',
            'external_link' => 'max:255',
            'name_ar' => 'required|min:2|max:255',
            'external_link_ar' => 'max:255',
            // 'link_priority' => 'max:30|integer|nullable|unique:links',
            'link_priority' => 'max:30|integer|unique:links,link_priority,'.$id,

        ]);


        if ($validitor->fails()) {
            alert()->error('Opps...','There is some issue with input');

            return Redirect::route('edit-links',$id)->withErrors($validitor)->withInput();
        }


        $links =  Links::find($id);





        $links->name = $request->name;
        $links->external_link = $request->external_link;
        $links->link_priority = $request->link_priority;
        $links->name_ar = $request->name_ar;
        $links->external_link_ar = $request->external_link_ar;

        $links->save();
        Alert::success('Success ', 'Links has been Updated');

        return Redirect::route('show-links');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Links  $links
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
      $links =  Links::find($id);
      $links->delete();
      return back();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit