Use shorthand assignment for basic getters

This commit is contained in:
Alex Cabal 2025-02-27 16:03:26 -06:00
parent 99b5fd66f2
commit 7f5ffb4aea
21 changed files with 142 additions and 326 deletions

View file

@ -26,17 +26,13 @@ class Patron{
// *******
protected function GetLastPayment(): ?Payment{
if(!isset($this->_LastPayment)){
$this->_LastPayment = Db::Query('
return $this->_LastPayment ??= Db::Query('
SELECT *
from Payments
where UserId = ?
order by Created desc
limit 1
', [$this->UserId], Payment::class)[0] ?? null;
}
return $this->_LastPayment;
}