php - Laravel Validation of Checkbox and Input? -


in laravel, how do validation check if checkbox checked , text input not empty.

for example:

if checkbox ticked

<input type="checkbox" name="has_login" checked="checked" value="1"> 

and pin not empty validation should passed.

<input type="text" name="pin" value=""> 

in request file file:

public function rules() {     return [           'has_login' => ??,     ]; } 

you should try way:

public function rules() {     return [           'has_login' => 'accepted',           'pin' => 'required',     ]; } 

Comments