Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Michał Sieciechowicz | 248006a830 |
|
@ -23,7 +23,7 @@ abstract class Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function QueryModel() {
|
protected static function QueryModel() {
|
||||||
if (true || (self::$query === null && self::class !== static::class)) {
|
if (self::$query === null && self::class !== static::class) {
|
||||||
self::$query = static::SetQueryModel();
|
self::$query = static::SetQueryModel();
|
||||||
}
|
}
|
||||||
return self::$query;
|
return self::$query;
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Fufle\ORM\Providers;
|
|
||||||
|
|
||||||
use Fufle\ORM\Model;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\Contracts\Auth\UserProvider;
|
|
||||||
use Illuminate\Contracts\Auth\Authenticatable;
|
|
||||||
|
|
||||||
class PassportUserProvider implements UserProvider {
|
|
||||||
/**
|
|
||||||
* The ORM User Model
|
|
||||||
*/
|
|
||||||
private $model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new ORM user provider.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct(Model $userModel) {
|
|
||||||
$this->model = $userModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a user by the given credentials.
|
|
||||||
*
|
|
||||||
* @param array $credentials
|
|
||||||
* @return \Illuminate\Contracts\Auth\Authenticatable|null
|
|
||||||
*/
|
|
||||||
public function retrieveByCredentials(array $credentials) {
|
|
||||||
if (empty($credentials)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->model->findForPassport($credentials['username']);
|
|
||||||
|
|
||||||
return $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a user against the given credentials.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
|
||||||
* @param array $credentials Request credentials
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function validateCredentials(Authenticatable $user, Array $credentials) {
|
|
||||||
return ($credentials['username'] == $user->getAuthIdentifier() &&
|
|
||||||
md5($credentials['password']) == $user->getAuthPassword());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function retrieveById($identifier) {
|
|
||||||
$userClass = get_class($this->model);
|
|
||||||
return $userClass::FindOrFail($identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function retrieveByToken($identifier, $token) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateRememberToken(Authenticatable $user, $token) {
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue