@@ -91,8 +91,8 @@ class AuthServiceProvider extends ServiceProvider
91
91
92
92
public function boot()
93
93
{
94
- Bartender::registerProvider ('google');
95
- Bartender::registerProvider ('microsoft');
94
+ Bartender::serve ('google');
95
+ Bartender::serve ('microsoft');
96
96
}
97
97
}
98
98
```
@@ -111,7 +111,7 @@ class AuthServiceProvider extends ServiceProvider
111
111
112
112
public function boot()
113
113
{
114
- Bartender::useUserModel (User::class);
114
+ Bartender::setUserModel (User::class);
115
115
}
116
116
}
117
117
```
@@ -137,13 +137,13 @@ route, and the users account will automatically be created or updated.
137
137
138
138
Almost everything can be swapped out in Bartender.
139
139
140
-
141
- If you would like to handle everything yourself for redirects and callbacks, you may create your own ` ProviderHandler ` :
140
+ If you would like to handle everything yourself for OAuth redirects and callbacks, you may create your own ` ProviderHandler ` :
142
141
143
142
``` php
144
143
namespace App\Socialite;
145
144
146
145
use Illuminate\Http\Request;
146
+ use Laravel\Socialite\Contracts\Provider;
147
147
use DirectoryTree\Bartender\ProviderHandler;
148
148
149
149
class UserProviderHandler implements ProviderHandler
@@ -176,14 +176,32 @@ class UserProviderHandler implements ProviderHandler
176
176
return redirect()->route('dashboard');
177
177
}
178
178
}
179
-
180
179
```
181
180
181
+ Then, provide it into the second argument in the ` Bartender::serve ` method:
182
+
183
+ ``` php
184
+ // app/Providers/AuthServiceProvider.php
185
+
186
+ use App\Socialite\UserProviderHandler;
187
+ use DirectoryTree\Bartender\Facades\Bartender;
188
+
189
+ class AuthServiceProvider extends ServiceProvider
190
+ {
191
+ // ...
192
+
193
+ public function boot()
194
+ {
195
+ Bartender::serve('google', UserProviderHandler::class);
196
+ Bartender::serve('microsoft', UserProviderHandler::class);
197
+ }
198
+ }
199
+ ```
182
200
183
201
### User Creation & Updating
184
202
185
- If you would like to customize the creation of the user provider, you can create your own
186
- ` UserProvider ` implementation:
203
+ If you would like to customize the creation of the user in the default
204
+ handler, you may create your own ` ProviderRepository ` implementation:
187
205
188
206
``` php
189
207
namespace App\Socialite;
@@ -233,8 +251,9 @@ class AppServiceProvider extends ServiceProvider
233
251
234
252
### User Redirects & Flash Messaging
235
253
236
- If you would like to customize the behavior of the redirects and flash messages depending
237
- on the outcome of a OAuth callback, you can create your own ` ProviderRedirector ` implementation:
254
+ If you would like to customize the behavior of the redirects of the default
255
+ redirector and flash messages depending on the outcome of a OAuth callback,
256
+ you can create your own ` ProviderRedirector ` implementation:
238
257
239
258
``` php
240
259
namespace App\Socialite;
0 commit comments