Last active
August 15, 2018 03:32
-
-
Save sachinkiranti/96d73886a46abece41735722a109807a to your computer and use it in GitHub Desktop.
Laravel Useful helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (! function_exists('change_db_storage')) : | |
/** | |
* Changing all tables database storage | |
* i.e InnoDB/MyISAM | |
*/ | |
function change_db_storage( $storage = 'InnoDB' ) { | |
$tables = DB::select('SHOW TABLES'); | |
$tables = array_map(function ($table) use ($storage) { | |
DB::statement(sprintf("ALTER TABLE %s ENGINE = {$storage}", $table->Tables_in_smscore_db)); | |
return $table->Tables_in_smscore_db . " changed to {$storage} successfully."; | |
}, $tables); | |
return $tables; | |
} | |
endif; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment