現在のアプリケーションをlaravelフレームワークにアップグレードしています。既存のユーザーとパスワードのデータベースがあります。細かい作品にLaravel 5.1 Auth :: user()
私が右の表に、ユーザーモデルが接続されている、と私はまた、私は、ログをテストすることができbcryptのためにユーザーの一人のパスワードを更新しました。
ログとにリダイレクトしますしかし、あなたが期待しているダッシュボードは、Auth :: user()を返そうとすると何も得られません。
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'existing_users_table';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password'];
}
(認証::チェック()){ //ユーザーが... ログインしている}あなたが認証を呼び出している –
::ユーザー(場合は、このコード によって中かログインしている最初のチェックしてください)、あなたはコードを投稿できますか? – Laerte
または$ userId = Auth :: id()を使用してください。 –