Update
This commit is contained in:
48
app/Helpers/FirstParty/Credits/CreditsService.php
Normal file
48
app/Helpers/FirstParty/Credits/CreditsService.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\FirstParty\Credits;
|
||||
|
||||
use App\Models\UserCredit;
|
||||
|
||||
class CreditsService
|
||||
{
|
||||
public static function depositSubscription(int $userId, int $amount, ?string $description = null): bool
|
||||
{
|
||||
return CreditsHelper::deposit($userId, $amount, UserCredit::TYPE_SUBSCRIPTION, $description);
|
||||
}
|
||||
|
||||
public static function depositAlacarte(int $userId, int $amount, ?string $description = null): bool
|
||||
{
|
||||
return CreditsHelper::deposit($userId, $amount, UserCredit::TYPE_ALACARTE, $description);
|
||||
}
|
||||
|
||||
public static function spend(int $userId, int $amount, ?string $description = null, ?bool $overrideSubscriptionFirst = null): bool
|
||||
{
|
||||
return CreditsHelper::spend($userId, $amount, $description, $overrideSubscriptionFirst);
|
||||
}
|
||||
|
||||
public static function setSpendSubscriptionFirst(int $userId, bool $spendSubscriptionFirst): bool
|
||||
{
|
||||
return CreditsHelper::setSpendSubscriptionFirst($userId, $spendSubscriptionFirst);
|
||||
}
|
||||
|
||||
public static function balance(int $userId, ?string $type = null): int
|
||||
{
|
||||
return CreditsHelper::balance($userId, $type);
|
||||
}
|
||||
|
||||
public static function canSpend(int $userId, int $amount): bool
|
||||
{
|
||||
return CreditsHelper::canSpend($userId, $amount);
|
||||
}
|
||||
|
||||
public static function summary(int $userId): array
|
||||
{
|
||||
return CreditsHelper::summary($userId);
|
||||
}
|
||||
|
||||
public static function transactionHistory(int $userId, int $limit = 20): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
return CreditsHelper::transactionHistory($userId, $limit);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user