app/Http/Controllers/PostController.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(Request $request)
    {
        $input = $request->all();
        $validate = Validator::make($input, [
            'member' => 'required',
            'mode' => 'required',
        ]);
        if($validate->fails()) {
            return back()->with('error', 'Please enter mode of payment.');
        }
        $member = Member::find($request->member);
        if ($request->savings) {
            $member->creditSavings($request->savings, $request->mode);
        }
        if ($request->spesavings) {
            $member->creditSpecial($request->spesavings, $request->mode);
        }
        if ($request->building) {
            $member->creditBuilding($request->building, $request->mode);
        }
        if ($request->shares) {
            $member->creditShare($request->shares, $request->mode);
        }
        if ($request->loan) {
            $member->creditLoan($request->loan, $request->interest, $request->mode);
        }
        return redirect()->back()->with('suc', 'Posted successfully.');
    }
public function store ( Request $ request ) { $ input = $ request -> all ( ) ; $ validate = Validator :: make ( $ input , [ 'member' => 'required' , 'mode' => 'required' , ] ) ; if ( $ validate -> fails ( ) ) { return back ( ) -> with ( 'error' , 'Please enter mode of payment.' ) ; } $ member = Member :: find ( $ request -> member ) ; if ( $ request -> savings ) { $ member -> creditSavings ( $ request -> savings , $ request -> mode ) ; } if ( $ request -> spesavings ) { $ member -> creditSpecial ( $ request -> spesavings , $ request -> mode ) ; } if ( $ request -> building ) { $ member -> creditBuilding ( $ request -> building , $ request -> mode ) ; } if ( $ request -> shares ) { $ member -> creditShare ( $ request -> shares , $ request -> mode ) ; } if ( $ request -> loan ) { $ member -> creditLoan ( $ request -> loan , $ request -> interest , $ request -> mode ) ; } return redirect ( ) -> back ( ) -> with ( 'suc' , 'Posted successfully.' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .