<?php

namespace App\Http\Requests\InventoryRequests;

use Illuminate\Foundation\Http\FormRequest;
use App\Rules\ExistRule;
use EF;

class GrnRequest 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()
    {
        //parent::errorMessage('PO Number does not exists.');

        $current_path = url()->current();

        if($current_path === url('grn_generate'))
        {
           return $this->getValidationList();
        }
        if($current_path === url('grn_commit'))
        {
           return $this->getValidationList2();
        }

    }
     public function getValidationList()
    {
        $validation = [
           'po_number'                 =>  ['required'],
        ];
        return $validation;
    }
    public function getValidationList2()
   {
       $validation = [
          'accept_qty.*'                  =>  'required',


       ];
       return $validation;
   }


}
