magicai / app /Console /Commands /CheckYookassaCommand.php
Softin Trading
Initial commit from Github
5f32fbd
Raw History Blame Contribute Delete
802 Bytes
<?php
namespace App\Console\Commands;
use App\Models\YokassaSubscriptions;
use App\Services\GatewaySelector;
use Illuminate\Console\Command;
class CheckYookassaCommand extends Command
{
protected $signature = 'app:check-yookassa-command';
protected $description = 'Command description';
public function handle(): void
{
$items = YokassaSubscriptions::query()
->where('subscription_status', 'active')
->orWhere('subscription_status', 'yokassa_approved')
->get();
foreach ($items as $activeSub) {
$data_end_sub = $activeSub->next_pay_at;
if (now()->gt($data_end_sub)) {
$result = GatewaySelector::selectGateway('yokassa')::handleSubscribePay($activeSub->id);
}
}
}
}