未找到列:1054 Champ 'payment_gateway' inconnu dans

我参加了使用 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

            );



慕姐8265434
浏览 127回答 2
2回答

九州编程

打字的时候好像打错了payement_gateway => payment_gateway

慕侠2389804

确保了:1- 将 payment_gateway 添加到 Order 模型的可填充数组2-payment_gateway 列在表“订单”列中...
打开App,查看更多内容
随时随地看视频慕课网APP