我有多个用户注册。示例:约翰、本和布莱克
- 注册的第一批用户是 John。John 可以成功登录并将他的信息显示到视图中。
- 接下来是用户 Ben,他可以成功登录,但视图中显示的信息是针对 John 的,用户 blake 也是如此。
我试过这个但没有运气:
- php工匠视图:清除
- php工匠缓存:清除
- php工匠路线:清除
- php工匠优化
- 作曲家转储自动加载
我已经用这个检查用户:
{{ Auth::user()->名字}}
登录控制器
{
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => ['logout', 'userLogout']]);
}
public function userLogout()
{
Auth::guard('web')->logout();
return redirect('/');
}
}
用户模型
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
't_id','firstname','middlename','lastname','email','password'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
protected $primaryKey = 't_id';
用户表格
<form class="form-horizontal" role="form" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Login
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
Forgot Your Password?
</a>
</div>
</div>
</form>
有人吗?
谢谢