app/Http/Controllers/NgaoController.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)
    {
        $ngao = $request->isMethod('put') ? Ussddata::findOrFail($request->customeridnumber) : new Ussd;
        $ngao->customeridnumber = $request->input('customeridnumber');
        $ngao->customermobilenumber = $request->input('customermobilenumber');
        $ngao->loanproduct = $request->input('loanproduct');
        $ngao->loanamount = $request->input('loanamount');
        $ngao->loanterm = $request->input('loanterm');
        $ngao->customerfullnames = $request->input('customerfullnames');
        $ngao->loanapplicationdate = $request->input('loanapplicationdate');
        if($ngao->save()){
            return response()->json([
                'responsecode' => '200',
                'response' => 'Success',
                'status' => 'Processing'
            ]);
        }
        if(!$ngao->save()){
            return response()->json([
                'responsecode' => '-1',
                'response' => 'Failed',
                'status' => 'Pending loan application'
            ]);
        }
    }
public function store ( Request $ request ) { $ ngao = $ request -> isMethod ( 'put' ) ? Ussddata :: findOrFail ( $ request -> customeridnumber ) : new Ussd ; $ ngao -> customeridnumber = $ request -> input ( 'customeridnumber' ) ; $ ngao -> customermobilenumber = $ request -> input ( 'customermobilenumber' ) ; $ ngao -> loanproduct = $ request -> input ( 'loanproduct' ) ; $ ngao -> loanamount = $ request -> input ( 'loanamount' ) ; $ ngao -> loanterm = $ request -> input ( 'loanterm' ) ; $ ngao -> customerfullnames = $ request -> input ( 'customerfullnames' ) ; $ ngao -> loanapplicationdate = $ request -> input ( 'loanapplicationdate' ) ; if ( $ ngao -> save ( ) ) { return response ( ) -> json ( [ 'responsecode' => '200' , 'response' => 'Success' , 'status' => 'Processing' ] ) ; } if ( ! $ ngao -> save ( ) ) { return response ( ) -> json ( [ 'responsecode' => '-1' , 'response' => 'Failed' , 'status' => 'Pending loan application' ] ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
// $ngao->ngao_id = $request->input('ngao_id');