如何在模型上使用Laravel创建新的空数据库

问题描述:

是否可以使用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.