You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
623 B
PHP
39 lines
623 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
class Auth
|
|
{
|
|
|
|
protected $user;
|
|
|
|
private static function getDriver()
|
|
{
|
|
return Factory::createAuth();
|
|
}
|
|
|
|
public static function login($uid, $time)
|
|
{
|
|
self::getDriver()->login($uid, $time);
|
|
}
|
|
|
|
/**
|
|
* Get current user(cached)
|
|
*
|
|
* @return \App\Models\User
|
|
*/
|
|
public static function getUser()
|
|
{
|
|
global $user;
|
|
if ($user === null) {
|
|
$user = self::getDriver()->getUser();
|
|
}
|
|
return $user;
|
|
}
|
|
|
|
public static function logout()
|
|
{
|
|
self::getDriver()->logout();
|
|
}
|
|
}
|