不同的名称字段用户表? [英] Different name fields user table?

查看:134
本文介绍了不同的名称字段用户表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个字段(用户名,密码),并与2相同的字段(用户名,密码)的MySQL表形式,和我认证系统正常工作:)

不过,我不能让我的,如果表中的字段有不同的名称,例如它的工作:( my_user,MY_PASS

如果你只需要改变在用户名在其他字段也适用于我,这给了我的问题是在密码字段。

我的配置的 auth.php

 '司机'=> '雄辩'

更新

已经找到我的控制器解决方案,密码名称不能改变。

在(错误的):
我已经在首位做是错误的。

  $用户数据=阵列(
        my_user'=>输入::得到('my_user'),
        MY_PASS'=>输入::得到('MY_PASS')
    );

应该是

  $用户数据=阵列(
        my_user'=>输入::得到('my_user'),
        '密码'=>输入::得到('MY_PASS')
    );


解决方案

您可以定义你自己的 auth.php 的用户名和密码字段的config文件夹中。

 回阵列(
    '司机'=> '雄辩',
    用户名= GT; my_user',
    '密码'=> MY_PASS',
    模式= GT; '用户',
    '表'=> '用户',
 );

我希望这能有所帮助。

I have a form with 2 fields (username, password) and a mysql table with those 2 same fields (username, password), and I authentication system working properly :)

But, I can not make it work if my table fields have different names, for example: (my_user, my_pass).

If you just change the username field on the other also works for me, that gives me problems is the password field.

My config auth.php

'driver' => 'eloquent'

Update

Already found the solution in my controller, the password name can not change.

Before (WRONG): What I've done in first place was wrong

$userdata = array(
        'my_user' => Input::get('my_user'),
        'my_pass' => Input::get('my_pass')
    );

it should be

$userdata = array(
        'my_user' => Input::get('my_user'),
        'password' => Input::get('my_pass')
    );

解决方案

You can define you own username and password field in the auth.php inside the config folder.

 return array(
    'driver' => 'eloquent',
    'username' => 'my_user',
    'password' => 'my_pass',
    'model' => 'User',
    'table' => 'users',
 );

I hope this can be of some help.

这篇关于不同的名称字段用户表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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