JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "DeleteExpiredLinkeables.php"

Full Path: /home/markqprx/iniasli.pro/app-20260222054640/Console/Commands/DeleteExpiredLinkeables.php
File size: 849 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Console\Commands;

use App\Actions\Link\DeleteLinks;
use App\Actions\LinkGroup\DeleteLinkGroups;
use App\Models\Link;
use App\Models\LinkGroup;
use Carbon\Carbon;
use Illuminate\Console\Command;

class DeleteExpiredLinkeables extends Command
{
    /**
     * @var string
     */
    protected $signature = 'linkeables:delete_expired';

    /**
     * @var string
     */
    protected $description = 'Delete expired links and link groups.';

    public function handle()
    {
        $linkIds = Link::where('expires_at', '<', Carbon::now())->pluck('id');
        app(DeleteLinks::class)->execute($linkIds);

        $groupIds = LinkGroup::where('expires_at', '<', Carbon::now())->pluck('id');
        app(DeleteLinkGroups::class)->execute($groupIds);

        $this->info('Deleted all expired links and link groups.');
    }
}