<?php
namespace App\Http\Validators;

use Illuminate\Support\Facades\Validator;

class ProductValidator{

    public static function validate($data){
        $validator = Validator::make($data, [
            'category_id'   => 'required',
            'name'          => 'required|string|max:70',
            'unit_type'     => 'required',
            'unit_size'     => 'required',
            'unit_per_case' => 'required|numeric',
            'quantity'      => 'required|numeric',
            'type'          => 'required',
            'stock_location'=> 'required',
            'currency'      => 'required',
            'price'         => 'required|numeric',
            'description'   => 'required|string',
        ]);

        if($validator->fails()){
            return array(
                'status' => false,
                'errors' => $validator->errors()
            );
        }

        return array(
            'status' => true
        );
    }
}
