app/Http/Controllers/StudentDetailController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(StudentDetailRequest $request)
    {
        $data = $request->all();
        $ipa = $request->ipa;
        $ips = $request->ips;
        $matematika = $request->matematika;
        $total = $ipa+$ips+$matematika;
        StudentDetail::create($data);
        $nilai = Student::findorFail($request->student_id);
        $nilai->update(['nilai_total'=>$total]);
        return redirect()->route('home');
    }
public function store ( StudentDetailRequest $ request ) { $ data = $ request -> all ( ) ; $ ipa = $ request -> ipa ; $ ips = $ request -> ips ; $ matematika = $ request -> matematika ; $ total = $ ipa + $ ips + $ matematika ; StudentDetail :: create ( $ data ) ; $ nilai = Student :: findorFail ( $ request -> student_id ) ; $ nilai -> update ( [ 'nilai_total' => $ total ] ) ; return redirect ( ) -> route ( 'home' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .