@@ -66,7 +66,7 @@ public static function boot()
66
66
parent ::boot ();
67
67
68
68
static ::creating (function ($ model ) {
69
- if (config ( ' passport.client_uuids ' )) {
69
+ if (Passport:: clientUuids ( )) {
70
70
$ model ->{$ model ->getKeyName ()} = $ model ->{$ model ->getKeyName ()} ?: (string ) Str::orderedUuid ();
71
71
}
72
72
});
@@ -80,6 +80,7 @@ public static function boot()
80
80
public function user ()
81
81
{
82
82
$ provider = $ this ->provider ?: config ('auth.guards.api.provider ' );
83
+
83
84
return $ this ->belongsTo (
84
85
config ("auth.providers. {$ provider }.model " )
85
86
);
@@ -158,6 +159,21 @@ public function skipsAuthorization()
158
159
return false ;
159
160
}
160
161
162
+ /**
163
+ * Determine if the client has the given grant type.
164
+ *
165
+ * @param string $grantType
166
+ * @return bool
167
+ */
168
+ public function hasGrantType ($ grantType )
169
+ {
170
+ if (! isset ($ this ->attributes ['grant_types ' ]) || ! is_array ($ this ->grant_types )) {
171
+ return true ;
172
+ }
173
+
174
+ return in_array ($ grantType , $ this ->grant_types );
175
+ }
176
+
161
177
/**
162
178
* Determine whether the client has the given scope.
163
179
*
@@ -166,7 +182,7 @@ public function skipsAuthorization()
166
182
*/
167
183
public function hasScope ($ scope )
168
184
{
169
- if (!is_array ($ this ->scopes )) {
185
+ if (! isset ( $ this -> attributes [ ' scopes ' ]) || ! is_array ($ this ->scopes )) {
170
186
return true ;
171
187
}
172
188
@@ -218,9 +234,8 @@ public function getIncrementing()
218
234
*
219
235
* @return \Illuminate\Database\Eloquent\Factories\Factory
220
236
*/
221
- public static function newFactory ()
222
- {
223
- return ClientFactory::new ();
224
- }
225
-
237
+ // public static function newFactory()
238
+ // {
239
+ // return ClientFactory::new();
240
+ // }
226
241
}
0 commit comments