i want to integrate with paddle payment but will I run this code i got this error Call to a member function paddleOptions() on null
This my controller
`try { $paylink = Auth::user()->charge(50.0, 'Premium'); dd($paylink);
return view('admin.payment.test', [
'paylink' => $paylink,
]);
} catch (\Exception $e) {
echo $e->getMessage();
}`
this blade
<a href="{{ $paylink }}">Pay</a>
If the user is not authenticated,
Auth::user()will return null. So, when trying to call the charge method on null, you'll encounter this error. Make sure that you have used middleware for this route to make it available only for authed users:Or you can simply add this code to your top of method in controller: