Laravel Form Request several validation rules of same type

Viewed 1476

I have a Form Request Validation file, which checks is an input field not empty ('required') and then if it's value exists in the database in table 'table1'.

I want to add a 2nd exist rule to the same input field, and return a message if 2nd exist validation rule is not met:

public function rules()
    {
        return [
            'tour' => 'required|exists:table1,id|//another exists: table2, id//'
        ];
    }

        public function messages()
    {
        return [
            'tour.required' => 'Message 1!',
            'tour.exists:table1,id' => 'Message 2!',
            'tour.//another exists: table2, id//' => 'Message 3!'
        ];
}

Right now only 2nd rule works. Any ideas how-to?:)

thank you all in advance!

1 Answers
Related