public function postIndex(FormRequest $request, Cart $cart) { if (!form('cart_review')->handle($request)) { return redirect('checkout'); } Message::addSuccess('Order #' . $cart->id . ' has been received!'); return redirect('cart/success'); }
/** * @param $entity * @param null $id * @return Entity */ protected function validateEntity($entity, $id = null) { if (app()->bound("entity.{$entity}")) { $model = entity($entity); // passing < 1 will allow new entities if ($id > 0) { $model = $model->find($id); } if ($model) { return $model; } else { Message::addError("{$entity} not found in database for id '{$id}'."); } } else { Message::addError("Entity '{$entity}' not found."); } }