mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Improve error message for people trying to log in to the Patrons Circle
This commit is contained in:
parent
95d1b9e02e
commit
cf5f488cae
9 changed files with 104 additions and 11 deletions
16
lib/User.php
16
lib/User.php
|
@ -11,6 +11,7 @@ use function Safe\preg_match;
|
|||
* @property string $Url
|
||||
* @property ?Patron $Patron
|
||||
* @property ?NewsletterSubscription $NewsletterSubscription
|
||||
* @property ?Payment $LastPayment
|
||||
*/
|
||||
class User{
|
||||
use Traits\Accessor;
|
||||
|
@ -27,6 +28,7 @@ class User{
|
|||
protected bool $_IsRegistered;
|
||||
/** @var array<Payment> $_Payments */
|
||||
protected array $_Payments;
|
||||
protected ?Payment $_LastPayment;
|
||||
protected Benefits $_Benefits;
|
||||
protected string $_Url;
|
||||
protected ?Patron $_Patron;
|
||||
|
@ -87,6 +89,20 @@ class User{
|
|||
return $this->_Payments;
|
||||
}
|
||||
|
||||
protected function GetLastPayment(): ?Payment{
|
||||
if(!isset($this->_LastPayment)){
|
||||
$this->_LastPayment = Db::Query('
|
||||
SELECT *
|
||||
from Payments
|
||||
where UserId = ?
|
||||
order by Created desc
|
||||
limit 1
|
||||
', [$this->UserId], Payment::class)[0] ?? null;
|
||||
}
|
||||
|
||||
return $this->_LastPayment;
|
||||
}
|
||||
|
||||
protected function GetBenefits(): Benefits{
|
||||
if(!isset($this->_Benefits)){
|
||||
if(isset($this->UserId)){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue