laravel-nami-api/src/NamiUser.php

48 lines
1009 B
PHP
Raw Normal View History

2020-06-27 23:45:49 +02:00
<?php
namespace Zoomyboy\LaravelNami;
use Illuminate\Contracts\Auth\Authenticatable;
class NamiUser implements Authenticatable {
2021-06-18 19:29:21 +02:00
public $mglnr;
2020-06-27 23:45:49 +02:00
public static function fromCredentials(array $credentials): ?self {
$user = new static();
$user->mglnr = $credentials['mglnr'];
return $user;
}
public function getNamiApi() {
2021-04-10 00:28:27 +02:00
return $this->attemptNamiLogin(cache('member.'.$this->mglnr)['credentials']['password']);
2020-06-27 23:45:49 +02:00
}
public function getNamiGroupId() {
return $this->groupid;
}
public function getAuthIdentifierName() {
return 'mglnr';
}
public function getAuthIdentifier() {
return $this->{$this->getAuthIdentifierName()}.'-'.$this->groupid;
}
public function getAuthPassword() {
return null;
}
public function getRememberToken() {
return null;
}
public function setRememberToken($value) {}
public function getRememberTokenName() {
return null;
}
}