0

how to check a field is exactly equal to a string or number
I want to check a field named course_id is equal a field of database id in course database. now I want to check if course_id is equal to id.

1

2 Answers 2

1

You can validate it by using the exists validation rule:

$validationRules = ['course_id' => 'exists:course,id'];
Sign up to request clarification or add additional context in comments.

Comments

0

create rule as below and use validator on input

$rules = array(
        'id'    => 'exists:your_table_name'
    );

for more help https://laravel.com/docs/5.2/validation#rule-exists

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.