Skip to content
Permalink
Browse files

formatting

  • Loading branch information...
taylorotwell committed Mar 3, 2019
1 parent accb93b commit 9bb76853403fcb071b9454f1dc0369a8b42c3257
Showing with 21 additions and 20 deletions.
  1. +21 −20 src/Illuminate/Auth/EloquentUserProvider.php
@@ -47,9 +47,9 @@ public function retrieveById($identifier)
{
$model = $this->createModel();
return $this->modelQuery($model)
->where($model->getAuthIdentifierName(), $identifier)
->first();
return $this->newModelQuery($model)
->where($model->getAuthIdentifierName(), $identifier)
->first();
}
/**
@@ -63,15 +63,18 @@ public function retrieveByToken($identifier, $token)
{
$model = $this->createModel();
$retrievedModel = $this->modelQuery($model)->where($model->getAuthIdentifierName(), $identifier)->first();
$retrievedModel = $this->newModelQuery($model)->where(
$model->getAuthIdentifierName(), $identifier
)->first();
if (! $retrievedModel) {
return null;
}
$rememberToken = $retrievedModel->getRememberToken();
return $rememberToken && hash_equals($rememberToken, $token) ? $retrievedModel : null;
return $rememberToken && hash_equals($rememberToken, $token)
? $retrievedModel : null;
}
/**
@@ -111,7 +114,7 @@ public function retrieveByCredentials(array $credentials)
// First we will add each credential element to the query as a where clause.
// Then we can execute the query and, if we found a user, return it in a
// Eloquent User "model" that will be utilized by the Guard instances.
$query = $this->modelQuery();
$query = $this->newModelQuery();
foreach ($credentials as $key => $value) {
if (Str::contains($key, 'password')) {
@@ -143,30 +146,28 @@ public function validateCredentials(UserContract $user, array $credentials)
}
/**
* Create a new instance of the model.
* Get a new query builder for the model instance.
*
* @return \Illuminate\Database\Eloquent\Model
* @param \Illuminate\Database\Eloquent\Model|null $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function createModel()
protected function newModelQuery($model = null)
{
$class = '\\'.ltrim($this->model, '\\');
return new $class;
return is_null($model)
? $this->createModel()->newQuery()
: $model->newQuery();
}
/**
* Get a new query builder for the model instance.
* Create a new instance of the model.
*
* @param \Illuminate\Database\Eloquent\Model|null $model
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Eloquent\Model
*/
protected function modelQuery($model = null)
public function createModel()
{
if (is_null($model)) {
$model = $this->createModel();
}
$class = '\\'.ltrim($this->model, '\\');
return $model->newQuery();
return new $class;
}
/**

0 comments on commit 9bb7685

Please sign in to comment.
You can’t perform that action at this time.