Level 75
@amifidele Check your logs file and post it here.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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', 'CheckoutController@store')->name('checkout.store');
@amifidele So you don't have set your database, check credentials in .env on your production server and set it correctly.
Please or to participate in this conversation.