Support the ongoing development of Laravel.io →
Forms Validation Queues
Last updated 1 year ago.
0

I guess you don't even to have to build a custom validation rule.

Just by using the Exists built-in validation rule : http://laravel.com/docs/validation#rule-exists

Like in your case :

$country_id =  Input::get('country_id')
'country_id' => "exists:Countries,id,$country_id"

With the validator :

$validator = Validator::make(
    array(
        'country_id' => $country_id,
    ),
    array(
        'country_id' => "exists:Countries,id,$country_id"
    )
);
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.