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

查看:18
本文介绍了如何使用 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.

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

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