PHP code example of envor / laravel-database-manager
1. Go to this page and download the library: Download envor/laravel-database-manager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
envor / laravel-database-manager example snippets
// config for Envor/DatabaseManager
return [
/***
* The disk where the sqlite database files will be stored.
*/
'sqlite_disk' => 'local',
/***
* Available drivers that can be managed.
*/
'managers' => [
'sqlite' => \Envor\DatabaseManager\SQLiteDatabaseManager::class,
'mysql' => \Envor\DatabaseManager\MySQLDatabaseManager::class,
]
];
// controller
public function store(Request $request)
{
$this->validate($request->all());
$databaseManager = (new Envor\DatabaseManager)
->manage($request->database_driver)
->createDatabase($request->database_name);
if($databaseManager){
$request->user()->databases()->create([
'name' => $request->database_name,
'driver' => $request->database_driver,
]);
}
}