Skip to content

Commit

Permalink
fix: disallow transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Sep 4, 2024
1 parent 68a2fab commit 7f970cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Models/User/UserItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getDataAttribute() {
* @return array
*/
public function getIsTransferrableAttribute() {
if (!isset($this->data['disallow_transfer']) && $this->item->allow_transfer) {
if ((!isset($this->data['disallow_transfer']) || !$this->data['disallow_transfer']) && $this->item->allow_transfer) {
return true;
}

Expand Down
3 changes: 1 addition & 2 deletions app/Services/ShopManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ public function buyStock($data, $user) {

if (!fillUserAssets($assets, null, $user, 'Shop Purchase', [
'data' => $shopLog->itemData,
'disallow_transfer' => $shopStock->disallow_transfer,
'notes' => 'Purchased '.format_date($shopLog->created_at),
])) {
] + ($shopStock->disallow_transfer ? ['disallow_transfer' => true] : []))) {
throw new \Exception('Failed to purchase item.');
}

Expand Down

0 comments on commit 7f970cb

Please sign in to comment.