Just out of curiosity is it possible to do something like this:
$commands = [
strtolower('JUST TESTING'),
date('Y-m-d H:i:s'),
strtoupper('Done!'),
];
foreach ($commands as $command) {
$command;
}
This of course doesn't work! Is there a way to make it work?
My specific use case is something like this:
private function dropDatabasesAndMySQLUsers(): void
{
foreach ($this->getCommands() as $command) {
$command;
}
$this->info('Done! All app Databases and MySQL users are dropped');
}
public function getCommands(): array
{
return [
\DB::statement("DROP USER IF EXISTS 'myuser'@'localhost'"),
\DB::statement("DROP DATABASE IF EXISTS manager")
// I have about 20-30 of these
];
}