Skip to content

Instantly share code, notes, and snippets.

@tianvay
Created June 21, 2018 08:57
Show Gist options
  • Save tianvay/af173c9c2a97f2a739de839b2d0d929a to your computer and use it in GitHub Desktop.
Save tianvay/af173c9c2a97f2a739de839b2d0d929a to your computer and use it in GitHub Desktop.
public static function motd()
{
$maxrandom = Monster::count('id');
$randomid = random_int(1,$maxrandom);
$monster = Monster::find($randomid);
// we don't want:
// -unawakened monsters
// -previously featured
// -special monsters
// as our monster of the day!
while($monster->awakens_from == null
or $monster->article != null
or str_contains($monster->awakens_from, [
'Angelmon',
'Rainbowmon',
'Imperfect',
'(Attack)',
'(Support)'
])){
$randomid = random_int(1,$maxrandom);
$monster = Monster::find($randomid);
}
return $monster;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment