我已经看过所有其他问题,但我无法弄清楚为什么我的Auth ::尝试不起作用
然后,我将显示其中涉及的代码:
- models / Usuario.php -
use \Illuminate\Auth\UserInterface;
class Usuario extends Eloquent implements UserInterface{
protected $table = 'User_Account';
protected $hidden = array('password');
public function getAuthIdentifier() {
return $this->getKey();
}
public function getAuthPassword() {
return $this->password;
}
}
?>
auth.php
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This driver manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent"
|
*/
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => 'Usuario',
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'User_Account',
/*
|--------------------------------------------------------------------------
| Password Reminder Settings
|--------------------------------------------------------------------------
|
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
| The "expire" time is the number of minutes that the reminder should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
我的路线::帖子(控制器@方法)在这里: $ validator = $ this-&gt; getLoginValidator();
if ($validator->passes()) {
if(Auth::attempt(array('username' => Input::get('username'), 'password' => Input::get('password')))){
echo "entrou";
}
echo "n entrou";
} else{
echo "Validation failed!";
}
我已经看到来自每个Input :: get的内容,一切似乎都没问题。
只是为了获取信息,我的表格如下:
列类型为空默认注释
id int(8)否
firstname varchar(40)没有
lastname varchar(40)否
password varchar(60)否
username varchar(40)否
points int(8)No 0
created_at datetime否
updated_at datetime否
如果您需要其他信息以帮助我,我会自由地给予。