第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 Laravel 中為自定義注冊表單設(shè)置自定義自動登錄

如何在 Laravel 中為自定義注冊表單設(shè)置自定義自動登錄

PHP
茅侃侃 2022-07-22 19:01:34
這是 laravel 中的用戶注冊自定義表單。public function register(RegisterTalentRequest $request) {    $talent = $this->create($request->except('_method', '_token'));    //up till here the registration values are successfully saved in the     //database table, but it's not logged in following the below code    //and is directing to the custom login page.    Auth::attempt(['email' => $request->email, 'password' => $request->password]);    return redirect()->route('dashboard'); //directing to login and not dashboard}
查看完整描述

2 回答

?
慕田峪9158850

TA貢獻1794條經(jīng)驗 獲得超8個贊

默認(rèn)情況下,Auth外觀(或auth()輔助函數(shù))將使用文件guard中的默認(rèn)設(shè)置config/auth.php

如果您想在登錄或注冊方法中使用不同的保護,您需要顯式設(shè)置它:

Auth::guard('guard-name')->attempt(...);

或者,當(dāng)使用authorguest中間件時,您可以傳遞您想要使用的保護,例如 (auth:guard-nameguest:guard-name) 這會將默認(rèn)保護設(shè)置guard-name為請求的其余部分,因此您不需要顯式設(shè)置它。


查看完整回答
反對 回復(fù) 2022-07-22
?
牧羊人nacy

TA貢獻1862條經(jīng)驗 獲得超7個贊

我假設(shè)在您注冊時它返回了一個用戶。那么你可以使用這個

Auth::login($user);


查看完整回答
反對 回復(fù) 2022-07-22
  • 2 回答
  • 0 關(guān)注
  • 172 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號