Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
0 / 0
CRAP
100.00% covered (success)
100.00%
0 / 0
StoreVariant
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
0 / 0
 authorize
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
0 / 0
 rules
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
0 / 0
<?php
namespace Mtc\Shop\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class StoreVariant extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $variant = \Route::input('variant', null);
        return [
            'node.title' => 'required|max:255',
            'node.description' => 'required|max:255',
            'variant.sku' => 'max:255',
            'variant.stock_enabled' => 'boolean',
            'variant.stock_quantity' => 'integer|required_if:variant.stock_enabled,1',
            'variant.shipping_weight' => 'numeric|min:0',
            'variant.shipping_dimensions_length' => 'numeric|min:0',
            'variant.shipping_dimensions_width' => 'numeric|min:0',
            'variant.shipping_dimensions_height' => 'numeric|min:0'
        ];
    }
}