我参加了使用 laravel 的电子商务培训,我想通过 paypal 购物车进行在线支付,但它在payment_gateway表格订单领域给我错误,Column not found: 1054 Field 'payment_gateway' unknown in field list。
你好,我参加了一个使用 laravel 的电子商务培训,我想通过 paypal 购物车进行在线支付,但它在payment_gateway表格订单领域给我错误,Column not found: 1054 Field 'payment_gateway' unknown in field list。
checkoutController.php
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function paypalCheckout(Request $request)
{
// Check race condition when there are less items available to purchase
if ($this->productsAreNoLongerAvailable()) {
return back()->withErrors('Sorry! One of the items in your cart is no longer avialble.');
}
$gateway = new \Braintree\Gateway([
'environment' => config('services.braintree.environment'),
'merchantId' => config('services.braintree.merchantId'),
'publicKey' => config('services.braintree.publicKey'),
'privateKey' => config('services.braintree.privateKey')
]);
$nonce = $request->payment_method_nonce;
$result = $gateway->transaction()->sale([
'amount' => round(getNumbers()->get('newTotal') / 100, 2),
'paymentMethodNonce' => $nonce,
'options' => [
'submitForSettlement' => true
]
]);
$transaction = $result->transaction;
if ($result->success) {
$order = $this->addToOrdersTablesPaypal(
$transaction->paypal['payerEmail'],
$transaction->paypal['payerFirstName'].' '.$transaction->paypal['payerLastName'],
null
);
九州编程
慕侠2389804