LeanIcon / phpapi

0 stars 0 forks source link

Darryldecode\Cart\Exceptions\InvalidItemException #119

Open programmeroscar opened 4 years ago

programmeroscar commented 4 years ago

Darryldecode\Cart\Exceptions\InvalidItemException validation.required https://nnuro.gohidigital.com/admin/retailer/retailercart/2

@return array $item;

 * @throws InvalidItemException

 */

protected function validate($item)

{

    $rules = array(

        'id' => 'required',

        'price' => 'required|numeric',

        'quantity' => 'required|numeric|min:1',

        'name' => 'required',

    );

    $validator = CartItemValidator::make($item, $rules);

    if ($validator->fails()) {

        **throw new InvalidItemException($validator->messages()->first());**

    }

    return $item;

}

/**

 * add row to cart collection

 *

 * @param $id

 * @param $item

 * @return bool

 */

protected function addRow($id, $item)

{

    if ($this->fireEvent('adding', $item) === false) {
programmeroscar commented 4 years ago

This was when i was adding product to PO cart