| Server IP : 138.197.107.151 / Your IP : 216.73.217.7 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/silversharkdev/app/Console/Commands/ |
Upload File : |
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Website;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Mail;
use App\Helpers\EncryptionHelper;
use App\Http\Controllers\WebsiteController;
use Illuminate\Http\Request;
use Carbon\Carbon;
class RemoveOneTimeWebsiteCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:remove-one-time-website-command';
/**
* The console command description.
*
* @var string
*/
protected $description = 'To remove one time paid websites after 14 days.';
/**
* Execute the console command.
*/
public function handle()
{
//
$websites = Website::where("websites.status","completed")
->join('pricing_plans', 'websites.active_plan_id', '=', 'pricing_plans.id')
->whereRaw("websites.id not in (select id from websites_archive_requests where websites_archive_requests.status!='completed')")
->where('websites.last_payment_date', '<=', date("Y-m-d H:i:s", time()-14*24*60*60))
->where('pricing_plans.type', '=', "one-time")
->select('websites.*')
->limit(5);
//echo $websites->toSql();
$websites= $websites->get();
//echo date("Y-m-d H:i:s", time()-14*24*60*60);
//print_r(sizeof($websites));
//print_r($websites);
//die;
$request = new Request();
foreach($websites as $website){
try{
$website_ctrl = new WebsiteController;
$website_ctrl->remove($request, $website->id);
} catch(Exception $e){
$website->status = "error";
$website->error = $e->getMessage();
$website->save();
}
}
}
}