checkout submit
Closed this issue ยท 9 comments
Illuminate \ Database \ QueryException (42S22)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shippingAddress' in 'field list' (SQL: insert into orders
(status
, shippingAddress
, number
, user_id
, updated_at
, created_at
) values (pending, shipping, 550-1reg-bvu3, 1, 2018-03-27 22:49:28, 2018-03-27 22:49:28))
What's the code that resulted this exception? shippingAddress is a relation (-> addresses table), not a column.
namespace App\Http\Controllers;
use App\Http\Requests\CheckoutRequest;
use Konekt\Address\Models\CountryProxy;
use Vanilo\Cart\Facades\Cart;
use Vanilo\Checkout\Facades\Checkout;
use Vanilo\Order\Contracts\OrderFactory;
class CheckoutController extends Controller
{
public function show()
{
$checkout = false;
if (Cart::isNotEmpty()) {
$checkout = Checkout::getFacadeRoot();
if ($old = old()) {
$checkout->update($old);
}
$checkout->setCart(Cart::model());
}
return view('checkout.show', [
'checkout' => $checkout,
'countries' => CountryProxy::all()
]);
}
public function submit(CheckoutRequest $request, OrderFactory $orderFactory)
{
$checkout = Checkout::getFacadeRoot();
$checkout->update($request->all());
$checkout->setCart(Cart::model());
$order = $orderFactory->createFromCheckout($checkout);
flash("Order created: " . $order->getNumber());
Cart::destroy();
return redirect()->route('shop.index');
}
}
I made the default installation of Vanilo and I used the controllers and views examples of Vanilo Demo
Default installation, you mean this: https://vanilo.io/docs/0.2/installation ?
yes
OK, I'll take a look into it.
I did the Vanilo Demo Application installation and the problem was solved
OK, cool. I'll still review the installation process, because it might be incorrect.
Thanks for the report anyways! ๐
run composer update, and update vanilo / order to v 0.2.1 this issue returned, this problem must be in some change in v 0.2.1
The fix has been released with vanilo/order v0.2.2