mercredi 31 octobre 2018

"General error: 1366 Incorrect integer value" even though I have set validation to nullable

I get this error: enter image description here

When I am trying to create and I am not filling the input for fixed_quantity

This is my store in my Controller(I have set fixed_quantity to nullable so it should be fine right?):

 $this->validate($request, [
        'name'                      => 'required',
        'description'               => 'required',
        'fixed_quantity'            => 'nullable',
        'max_increments'            => 'required|numeric|min:0',
    ]);

    DB::transaction(function () use ($request, $store, $variant) {

        $subscription_plan = new SubscriptionPlan([
            'store_id'                  => $store->uuid,
            'variant_id'                => $variant->uuid,
            'name'                      => $request->input('name'),
            'description'               => $request->input('description'),
            'max_increments'            => $request->input('max_increments'),
        ]);

        $subscription_plan->fixed_quantity = $request->input('fixed_quantity');

        $subscription_plan->save();

This is what is on my blade:

<div class="form-group">
    <label for="fixed_quantity">Quantity</label>
    <input class="form-control" type="number" id="fixed_quantity" name="fixed_quantity" value=""" placeholder="0">
</div>



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2RooxOk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire