问题描述
我使用的新功能在Laravel:
I used the new feature in Laravel:
php artisan make:auth
但是,当我注册它将使用数据库表用户
默认情况下,但我想改变这种状况到其他表。默认情况下它使用的updated_at
和 created_at
在该表中,我想删除了。
But when I register it will use the database table users
by default, but I want to change that to an other table. And by default it uses updated_at
and created_at
in that table, I want to remove that too.
认证/ AuthController
protected function create(array $data)
{
return User::create([
'voornaam' => $data['voornaam'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
应用\\用户
protected $fillable = [
'voornaam', 'email', 'password',
];
这是我认为要改变它的东西,但他们没有。我希望有人能够多一些告诉我这个问题。
This are the things I thought would change it, but they didn't. I hope somebody can tell me some more about this issue.
推荐答案
要更改表名称转到应用程序/ user.php的
,并设置属性 $表
来定制一个例子:
To change table name go to app/User.php
and set property $table
to custom one for example:
$table = 'new_table';
您也应该更改默认迁移。转到: /database/migrations/2014_10_12_000000_create_users_table.php
文件并更改用户
这里相同的名称。要删除时间戳您可以删除行:
You should also change default migration. Go to: /database/migrations/2014_10_12_000000_create_users_table.php
file and change users
here for the same name. To remove timestamps you can remove line:
$table->timestamps();
不过,如果我是你,我会重新考虑消除这些时间戳
however if I were you I would reconsider removing those timestamps
这篇关于Laravel 5.2 AUTH改变'用户'表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!