| 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/shark/app/Console/Commands/ |
Upload File : |
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Website;
use Mail;
class SendUpcomingPaymentReminders extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:send-upcoming-payment-reminders';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
//
$days = 30;
$date = Date("Y-m-d H:i:s", time()+ $days*24*60*60);
$websites = Website::where("next_payment_date",">=", $date)->where("reminder_email_sent",0)->limit(10)->get();
foreach($websites as $website){
if($website->user){
$user = $website->user;
Mail::send('emails.payment_reminder', [
'user' => $website->user,
'website' => $website,
'days' => $days
], function ($message) use ($user, $days) {
$message->to($user->email);
$message->subject('You next payment due in'.$days.' days');
});
}
$website->reminder_email_sent = 1;
$website->save();
}
}
}