5.5验证验证中的Laravel SQL问题 [英] Laravel SQL issue on 5.5 Auth Validation
问题描述
从一个新项目中,我尝试将用户"表重命名为"app.users".
From a fresh project, I tried to rename the "users" table to "app.users".
我设法通过更新schema :: create
I managed to update migrations by updating schema::create
Schema::create('app.users', function (Blueprint $table){});
Schema::create('app.password_resets', function (Blueprint $table){});
Schema::create('app.users', function (Blueprint $table){});
Schema::create('app.password_resets', function (Blueprint $table){});
并通过更改更新了user.php模型
and updated the user.php model by changing
protected $table = 'app.users';
我唯一的问题是当我尝试注册时,它会产生错误:Database [app] not configured
.如何在RegisterController中的Validator上添加架构信息
my only problem is when I try to register, it yields an error :Database [app] not configured
. How can I add schema information on the Validator in the RegisterController
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:app.users',
'password' => 'required|string|min:6|confirmed',
]);
推荐答案
在您的database.php
中,您还必须配置要引用的App数据库.
In your database.php
you have to configure the App database too to which you are referring.
'app' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'app',
'username' => 'foo',
'password' => 'bar',
],
'mysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'app',
'username' => 'foo',
'password' => 'bar',
],
希望这会有所帮助.
这篇关于5.5验证验证中的Laravel SQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!