如何使用 Laravel over Model 创建新的空数据库

有没有办法用 Laravel CodeBehind 创建新数据库?我的意思是,我无法使用 php artisan 或类似的东西.只是因为我想为每个注册用户创建一个数据库.之后我可以使用migration.我正在使用 Laravel 5.2.已经感谢您的支持.

is there any way to create new database with Laravel CodeBehind ? I mean, I'm not able to use php artisan or something like that. Just because I want to create a database for every registered user. After that I can use migration. I'm using Laravel 5.2. Thanks for your support already.

推荐答案

好吧,你可以为每个 bd 执行一个数据库查询,然后使用 mysql 或你的 sgbd database create 命令,例如;

well, you could perform a database query for each bd and than use the mysql or you sgbd database create command, for eg;

  DB::getConnection()->statement('CREATE DATABASE :schema', array('schema' => "dasdsdasdsadsadsa"))

它可能会满足您的需求.

It probably will work with what you want.

相关文章