W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
如果您的應(yīng)用程序可能使用完全不同的 Eloquent 模型、不同類型的用戶進行身份驗證,則可能需要為應(yīng)用程序中的每種用戶設(shè)置 guard。 這使您可以保護特定 guard 的請求。 例如,設(shè)置以下 guard config/auth.php
配置文件:
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
'api-customers' => [
'driver' => 'passport',
'provider' => 'customers',
],
以下路由將使用 customers
用戶提供者的 api-customers
guard 來驗證傳入的請求:
Route::get('/customer', function () {
//
})->middleware('auth:api-customers');
技巧:有關(guān)在 Passport 上使用多個用戶提供者的更多信息,請查閱密碼授予文檔.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: