这个问题是this
的延续我尝试使用Laravel Auth用途的默认user
表,
现在我将其更改为admin
表
所以我审阅了here
因此我尝试将表名更改为auth.php中的admin
'model' => 'User',
'table' => 'users',
到
'model' => 'AdminModel',
'table' => 'admin',
在AdminModel中我有protected $table = 'admin';
这是我的AdminModel:
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class AdminModel extends Eloquent implements UserInterface, RemindableInterface
{
protected $table = 'admin';
protected $fillable = array('UserName', 'Password');
public $timestamps = true;
public static $rules = array();
}
这是我的控制器:
if (Auth::attempt(array('UserName' => $UserName, 'password' => $password)))
{
return Redirect::intended('dashboard');
}
else
{
$queries = DB::getQueryLog();
print_r(end($queries));
}
它总是像这样打印查询
Array ( [query] => select * from `admin` where `UserName` = ? limit 1 [bindings] => Array ( [0] => a ) [time] => 1 )
可能是什么问题?