<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class OperasiCon extends Controller
{
    public function bTambahC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $result = $a + $b;
        return redirect('/bTambah')->with('info', 'Hasilnya adalah = '.$result);
    }

    public function bKurangC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $result = $a - $b;
        return redirect('/bKurang')->with('info', 'Hasilnya adalah = '.$result);
    }

    public function bKaliC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $result = $a * $b;
        return redirect('/bKali')->with('info', 'Hasilnya adalah = '.$result);
    }

    public function bBagiC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $result = $a / $b;
        return redirect('/bBagi')->with('info', 'Hasilnya adalah = '.$result);
    }

    public function pTambahC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $c = $request->input('c');
        $d = $request->input('d');
        $result1 = ($a * $d)+($b * $c);
        $result2 = $c * $d;
        return redirect('/pTambah')->with('info', 'Hasilnya adalah = '.$result1.'/'.$result2);
    }

    public function pKurangC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $c = $request->input('c');
        $d = $request->input('d');
        $result1 = ($a * $d)-($b * $c);
        $result2 = $c * $d;
        return redirect('/pKurang')->with('info', 'Hasilnya adalah = '.$result1.'/'.$result2);
    }

    public function pKaliC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $c = $request->input('c');
        $d = $request->input('d');
        $result1 = ($a * $d)*($b * $c);
        $result2 = $c * $d;
        return redirect('/pKali')->with('info', 'Hasilnya adalah = '.$result1.'/'.$result2);
    }

    public function pBagiC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $c = $request->input('c');
        $d = $request->input('d');
        $result1 = ($a * $d)/($b * $c);
        $result2 = $c * $d;
        return redirect('/pBagi')->with('info', 'Hasilnya adalah = '.$result1.'/'.$result2);
    }
}
