amifidele
1 week ago
124
6
Laravel

My laravel form is showing 500 server error on shared hosting

Posted 1 week ago by amifidele

My laravel form is working correctly on localhost but when is on shared hosting its gives a server error,

please help me to get out of this.

see my code in CheckoutController.php :

 public function store(Request $request)
    {

        $order = Order::create([
            'user_id' => auth()->user() ? auth()->user()->id : null,
            'billing_email' => $request->email,
            'billing_phone' => $request->phone,
            'billing_name' => $request->name,
            'billing_name_on_card' => $request->name_on_card,
            'billing_city' => $request->city,
            'billing_time' => $request->created_at,
            'billing_subtotal' => $request->newSubtotal,
            'billing_tax' => $request->newTax,
            'billing_total' => $request->newTotal,
            'error' => null,

        ]);


        foreach(Cart::content() as $product){
            OrderProduct::create([
                'order_id' => $order->id,
                'product_id' => $product->model->id,
                'quantity' => $product->qty,
            ]);
        }

        
       Mail::send(new OrderPlaced($order));

        Cart::instance('default')->destroy();

      
        return redirect()->route('success');
    }

my routes web.php code :

Route::post('/checkout', '[email protected]')->name('checkout.store');

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