app/Http/Requests/PromotionRequest.php
/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
Get the validation rules that apply to the request.
@return array
Get the validation rules that apply to the request . @return array
public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            case 'DELETE':
                return [];
            case 'POST': {
                return [
                    'product_id' => [
                        'required',
                        Rule::exists('products', 'id')
                    ],
                    'price' => 'required',
                    'ends_at' => 'required'
                ];
            }
        }
    }
public function rules ( ) { switch ( $ this -> method ( ) ) { case 'GET' : case 'DELETE' : return [ ] ; case 'POST' : { return [ 'product_id' => [ 'required' , Rule :: exists ( 'products' , 'id' ) ] , 'price' => 'required' , 'ends_at' => 'required' ] ; } } }
Get the validation rules that apply to the request.
Get the validation rules that apply to the request .