Files
vuefilemanager/src/App/Limitations/Engines/MeteredBillingLimitationEngine.php
Čarodej b4887cea0e - Restriction UI warning
- create folder restriction
- fixed UI bugs
2022-01-05 12:48:07 +01:00

27 lines
773 B
PHP

<?php
namespace App\Limitations\Engines;
use App\Users\Models\User;
use App\Limitations\LimitationEngine;
class MeteredBillingLimitationEngine implements LimitationEngine
{
public function canUpload(User $user, int $fileSize = 0): bool
{
// Disable upload when user has more than 3 failed payments
return ! ($user->failedPayments()->count() >= 3);
}
public function canDownload(User $user): bool
{
// Disable download when user has more than 3 failed payments
return ! ($user->failedPayments()->count() >= 3);
}
public function canCreateFolder(User $user): bool
{
// Disable create folder when user has more than 3 failed payments
return ! ($user->failedPayments()->count() >= 3);
}
}