icelander
1 year ago

Trying to get property of non-object

Posted 1 year ago by icelander

this is my controller where I believe is the source of the above mentioned error `` public function handleGatewayCallback(Request $request) { $paymentDetails = Paystack::getPaymentData();

    $banks_data = json_encode($paymentDetails, true);
    

    $bank = json_decode($banks_data,true);

    
   $amount= $bank['data']['amount']/100;
   $ref= $bank['data']['reference'];

   Session::put('ref', $ref);

   if($amount == 1000){

    $time= $bank['data']['paidAt'];
   
   $location = VehicleInformation::where('user_id', Auth::user()->id)->orderBy('created_at','desc')->value('location');
  
   $carProblem = VehicleInformation::where('user_id', Auth::user()->id)->orderBy('created_at','desc')->value('problem');
   $vehiclename = VehicleInformation::where('user_id', Auth::user()->id)->orderBy('created_at','desc')->value('vname');

   $fixedpay = FixedPayment::insert([
       'amount'=>$amount,
       'location'=>$location,
       'problem'=>$carProblem,
       'vname'=>$vehiclename,
       'paymentID'=>$ref,
       'user_id' => auth()->user()->id,
       'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
       'updated_at' => \Carbon\Carbon::now()->toDateTimeString()

       
   ]);
thanks

Please sign in or create an account to participate in this conversation.