我使用命令php artisan migrate迁移我的数据库连接,但我仍然得到相同的错误,我检查了一切,没有错.我使用了我在Laravel 4.2中使用的相同连接
这是我在控制台上收到的消息:
exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)' in C:\xampp\htdocs\Projects\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:47
Run Code Online (Sandbox Code Playgroud) 我有两个表用户和帖子.这是我的用户表迁移文件:
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->string('password_temp',60);
$table->integer('active');
$table->string('code',60);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
Run Code Online (Sandbox Code Playgroud)
这是我的帖子表迁移文件
public function up()
{
Schema::create('posts', function(Blueprint $table){
$table->increments('id');
$table->string('title');
$table->text('body');
$table->integer('user_id')->unsigned();
$table->string('slug');
$table->timestamps();
});
Schema::table('posts',function(Blueprint $table){
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade')
->onUpdate('cascade');
});
}
Run Code Online (Sandbox Code Playgroud)
AdminPostsController扩展Controller {public function store(Request $ request){
$validator = Validator::make($request->all(),Post::$rules);
if($validator->passes()){
$post = new Post();
$post->title = $request->get('title');
$post->body = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用laravel 5登录用户.这是我的控制器
public function postLogin(LoginRequest $request){
$remember = ($request->has('remember'))? true : false;
$auth = Auth::attempt([
'email'=>$request->email,
'password'=>$request->password,
'active'=>true
],$remember);
if($auth){
return redirect()->intended('/home');
}
else{
return redirect()->route('login')->with('fail','user not identified');
}
}
Run Code Online (Sandbox Code Playgroud)
当我输入错误的凭据,一切正常,但当我输入正确的,我收到此错误消息:
ErrorException in EloquentUserProvider.php line 110:
Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Models\User given, called in C:\xampp\htdocs\Projects\Pedagogia\Admin.pedagogia\vendor\laravel\framework\src\Illuminate\Auth\Guard.php on line 390 and defined
Run Code Online (Sandbox Code Playgroud)
我没有看到我做错了什么