<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Ir;

class IrController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function getIndex()
    {
          return view('Admin.IR');
    }

    /**
     * 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)
    {
            $save= new Ir;
        $save->type=$request->type;
        $save->product_nepali=$request->product_nepali;
        $save->product=$request->product;
        $save->interest_rate=$request->interest_rate;
    
          $save->token=AdminlogController::getToken('Ir');
         $save->save();

         return redirect('admin_ir')->with('info', 'Datas Saved Successfully!');
    }

    /**
     * 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)
    {
        $data=array(


        'type'=>$request->type,
        'product_nepali'=>$request->product_nepali,
        'product'=>$request->product,
        'interest_rate'=>$request->interest_rate,


        );

         Ir::where('id',$id)->update($data);
           return redirect('admin_ir')->with('info', 'Datas Updated Successfully!');
    }

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