a bit of progress
This commit is contained in:
@@ -6,6 +6,13 @@ use App\Models\Character;
|
||||
|
||||
class EconomyService
|
||||
{
|
||||
protected ActivityLogService $activityLogService;
|
||||
|
||||
public function __construct(ActivityLogService $activityLogService)
|
||||
{
|
||||
$this->activityLogService = $activityLogService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer money between characters
|
||||
*/
|
||||
@@ -23,8 +30,8 @@ class EconomyService
|
||||
$to->addMoney($amount);
|
||||
|
||||
// Log the transaction
|
||||
ActivityLog::logMoneyTransaction($from, 'spent', $amount, "Transfer to {$to->name}: {$reason}");
|
||||
ActivityLog::logMoneyTransaction($to, 'earned', $amount, "Transfer from {$from->name}: {$reason}");
|
||||
$this->activityLogService->logMoneyTransaction($from, 'spent', $amount, "Transfer to {$to->name}: {$reason}");
|
||||
$this->activityLogService->logMoneyTransaction($to, 'earned', $amount, "Transfer from {$from->name}: {$reason}");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -37,7 +44,7 @@ class EconomyService
|
||||
$character->addMoney($amount);
|
||||
|
||||
if ($amount > 0 && $reason) {
|
||||
ActivityLog::logMoneyTransaction($character, 'earned', $amount, $reason);
|
||||
$this->activityLogService->logMoneyTransaction($character, 'earned', $amount, $reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +60,7 @@ class EconomyService
|
||||
$character->removeMoney($amount);
|
||||
|
||||
if ($amount > 0 && $reason) {
|
||||
ActivityLog::logMoneyTransaction($character, 'spent', $amount, $reason);
|
||||
$this->activityLogService->logMoneyTransaction($character, 'spent', $amount, $reason);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user