app/Http/Controllers/Backend/PaymentController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request)
    {
        $rules = array('bookingid' =>'required');
        $validator = Validator::make($request->all(), $rules);
        if ($validator->fails()) return response()->json(array('result'=>false , 'message'=>$validator->errors()->first() ));
        $booking_id = $request->input('bookingid');
        $booking = Booking::where('id' , $booking_id )->first();
        if($booking == null) return response()->json(array('result'=>false , 'message'=>'can not define booking from id '.$booking_id));
        $booking->payment = 2;
        if($booking->save())
            return response()->json(array('result'=>true , 'message'=>'success' ));
        return response()->json(array('result'=>false , 'message'=>'update fail'));
    }
public function update ( Request $ request ) { $ rules = array ( 'bookingid' => 'required' ) ; $ validator = Validator :: make ( $ request -> all ( ) , $ rules ) ; if ( $ validator -> fails ( ) ) return response ( ) -> json ( array ( 'result' => false , 'message' => $ validator -> errors ( ) -> first ( ) ) ) ; $ booking_id = $ request -> input ( 'bookingid' ) ; $ booking = Booking :: where ( 'id' , $ booking_id ) -> first ( ) ; if ( $ booking == null ) return response ( ) -> json ( array ( 'result' => false , 'message' => 'can not define booking from id ' . $ booking_id ) ) ; $ booking -> payment = 2 ; if ( $ booking -> save ( ) ) return response ( ) -> json ( array ( 'result' => true , 'message' => 'success' ) ) ; return response ( ) -> json ( array ( 'result' => false , 'message' => 'update fail' ) ) ; }
Update the specified resource in storage.
Update the specified resource in storage .