如何在模型上使用Laravel创建新的空数据库 [英] How to create new empty database with Laravel over Model

查看:245
本文介绍了如何在模型上使用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.

这篇关于如何在模型上使用Laravel创建新的空数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆