I have this piece of code:
if($this->ask('Is this holiday booked? [y|N]')) {
$holiday->booked = true;
} else {
$holiday->booked = false;
}
in a Laravel 5.2 command, but whatever the response it always seems to return true.
I also tried:
if($this->ask('Is this holiday booked? [y|N]') === true) {
$holiday->booked = true;
} else {
$holiday->booked = false;
}
But this always enters it into the database as false regardless of if I enter y or n.
It will no doubt be something stupid, but can anyone see where I'm going wrong?
Thanks.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rB8O15
via IFTTT
Aucun commentaire:
Enregistrer un commentaire