Changeset View
Changeset View
Standalone View
Standalone View
src/app/Group.php
Show First 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | class Group extends Model | ||||
/** | /** | ||||
* Returns the wallet by which the group is controlled | * Returns the wallet by which the group is controlled | ||||
* | * | ||||
* @return \App\Wallet A wallet object | * @return \App\Wallet A wallet object | ||||
*/ | */ | ||||
public function wallet(): ?Wallet | public function wallet(): ?Wallet | ||||
{ | { | ||||
// Note: Not all domains have a entitlement/wallet | // Note: Not all domains have a entitlement/wallet | ||||
$entitlement = $this->entitlement()->withTrashed()->first(); | $entitlement = $this->entitlement()->withTrashed()->orderBy('created_at', 'desc')->first(); | ||||
return $entitlement ? $entitlement->wallet : null; | return $entitlement ? $entitlement->wallet : null; | ||||
} | } | ||||
} | } |