@@ -43,9 +43,7 @@ protected function getModelFromAdldap(User $user, $password)
43
43
$ model = $ this ->createModel ()->newQuery ()->where ([$ key => $ username ])->first ();
44
44
45
45
// Create the model instance of it isn't found.
46
- if (!$ model instanceof Model) {
47
- $ model = $ this ->createModel ();
48
- }
46
+ $ model = ($ model instanceof Model ? $ model : $ this ->createModel ());
49
47
50
48
// Set the username and password in case
51
49
// of changes in active directory.
@@ -58,9 +56,8 @@ protected function getModelFromAdldap(User $user, $password)
58
56
// attributes on the model.
59
57
$ model = $ this ->syncModelFromAdldap ($ user , $ model );
60
58
61
- if ($ this ->getBindUserToModel ()) {
62
- $ model = $ this ->bindAdldapToModel ($ user , $ model );
63
- }
59
+ // Bind the Adldap model to the elqoquent model if configured.
60
+ $ model = ($ this ->getBindUserToModel () ? $ this ->bindAdldapToModel ($ user , $ model ) : $ model );
64
61
65
62
return $ model ;
66
63
}
@@ -185,11 +182,9 @@ protected function handleAttributeRetrieval(User $user, $field)
185
182
} else {
186
183
$ value = $ user ->{$ field };
187
184
188
- if (is_array ($ value )) {
189
- // If the AD Value is an array, we'll
190
- // retrieve the first value.
191
- $ value = Arr::get ($ value , 0 );
192
- }
185
+ // If the AD Value is an array, we'll
186
+ // retrieve the first value.
187
+ $ value = (is_array ($ value ) ? Arr::get ($ value , 0 ) : $ value );
193
188
}
194
189
195
190
return $ value ;
@@ -236,9 +231,7 @@ protected function getAdldap($provider = null)
236
231
{
237
232
$ ad = Adldap::getFacadeRoot ();
238
233
239
- if (is_null ($ provider )) {
240
- $ provider = $ this ->getDefaultConnectionName ();
241
- }
234
+ $ provider = (is_null ($ provider ) ? $ this ->getDefaultConnectionName () : $ provider );
242
235
243
236
return $ ad ->getManager ()->get ($ provider );
244
237
}
0 commit comments