I already tried have a look at https://laravel.com/docs/5.4/validation but still , i don't really get what's is the difference between :
required_with_all
and
required_without
Anyone can explain to me in detail what's the difference ?
I already tried have a look at https://laravel.com/docs/5.4/validation but still , i don't really get what's is the difference between :
required_with_all
and
required_without
Anyone can explain to me in detail what's the difference ?
required_with_all :
Laravel Doc: The field under validation must be present only if all of the other specified fields are present.
required_without_all :
Laravel Doc: The field under validation must be present and not empty only when all of the other specified fields are not present.
Example:
$rules = array(
'facebook_id' => 'required_without_all:twitter_id,instagram_id',
'twitter_id' => 'required_without_all:facebook_id,instagram_id',
'instagram_id' => 'required_without_all:facebook_id,twitter_id',
);
$validator = Validator::make(Input::all(), $rules);
required_with:
Laravel Doc: The field under validation must be present only if any of the other specified fields are present.
Example:
$rules = array(
'sell' => 'required_without:rent',
'rent' => 'required_without:sell',
'price' => 'required_with:sell|numeric|min:0',
);
required_with:
The field under validation must be present and not empty only if any of the other specified fields are present.
required_with_all:
The field under validation must be present and not empty only if all of the other specified fields are present.
Note: Check bold text above.
For more detail see Laravel docs
© 2022 - 2024 — McMap. All rights reserved.