Laravel 內建Auth + 客製密碼驗證規則(Laravel 11)
Laravel 11 有異動許多地方,RouteServiceProvider、AuthServiceProvider… 都統一在AppServiceProvider中處理
新增一個會員的驗證機制來作為範例
- config/auth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'member' => [
'driver' => 'session',
'provider' => 'members',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
'members' => [
'driver' => 'member',
'model' => App\Models\Member::class,
],
],