[英]Laravel 5.1 Auth::attempt() not working if User has softdelete attribute
[英]Laravel 5.1 after Registration Auth::attempt no access to the user data on another page
在系統上注冊后,訪問經過身份驗證的用戶數據時出現問題。
在我的注冊過程中進行了一些驗證之后,我得到了以下內容:
if (Auth::attempt(array(
'username' => $customer->username,
'password' => $data['password']
))) {
return redirect('profile-setup');
}
我已經嘗試過在if語句中查看用戶數據,如下所示:
dd(Auth::user());
這實際上有效,我可以看到用戶數據。
但是,當我轉到刀片配置文件設置時,我嘗試了相同的模具,但是得到的是空值。
我不確定我錯過了什么。
如果有什么需要我提供的,請告訴我。 任何幫助,不勝感激。
謝謝
您可以查看您的情況是否存在以下任何一種情況:
protected $primaryKey = 'user__table_id_column_name';
在用戶模型中 公共功能嘗試(數組$ credentials = [],$ remember = false,$ login = true){..}
因此,請嘗試傳遞第二個參數以將其作為true
嘗試,看看它是否仍然存在。 情況並非如此,因為這應該自動發生,但請嘗試一次以確保安全
有關更多幫助,請僅檢查線程: Laravel Auth:attempt()將無法持久登錄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.