We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c19662 commit 19378bdCopy full SHA for 19378bd
src/Traits/HasWallets.php
@@ -43,6 +43,17 @@ trait HasWallets
43
*/
44
public function getWallet(string $slug): ?WalletModel
45
{
46
+ if (\array_key_exists($slug, $this->_wallets)) {
47
+ return $this->_wallets[$slug];
48
+ }
49
+
50
+ if ($this->relationLoaded('wallets')) {
51
+ $wallets = $this->getRelation('wallets');
52
+ foreach ($wallets as $wallet) {
53
+ $this->_wallets[$wallet->slug] = $wallet;
54
55
56
57
if (!\array_key_exists($slug, $this->_wallets)) {
58
$this->_wallets[$slug] = $this->wallets()
59
->where('slug', $slug)
0 commit comments