vendredi 24 avril 2020

Dynamic If else statement, value for condition is from database

is there a way to make this if else condition:

$searchUserTypeName = UserType::findOrFail(1);

if ($searchUserTypeName->name == "Captain" || $searchUserTypeName->name == "Member") {
  echo "This is Captain or Member"
} else if ($searchUserTypeName->name == "Mentor" || $searchUserTypeName->name == "Mentee") {
  echo "This is Mentor or Mentee"
}

to dynamic?

The value Captain, Member, Mentor and Mentee is from a mysql table

hope you can help

thanks



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3awy2nF
via IFTTT

Aucun commentaire:

Enregistrer un commentaire