connection = 'redis'; } /** * Execute the job. * * @return void */ public function handle() { //Declare variables $mailDelay = 5; //Get all of the moons from the rental database $moons = AllianceRentalMoons::all(); //Set today's date $today = Carbon::now(); //Get the esi configuration $esiConfig = config('esi'); /** * For each of the moons check the rental until date, the paid until date, * and compare them to today's current date. * * If the paid date is later than the rental until date, then update the rental until * date to match the paid date. If the paid until date is today or less, then update the * paid column of the moon to not paid. If the moon hasn't been paid 2 weeks after the first * of the month, then remove the renter, and send an eve mail to alliance leadership, and the renter * denoting failure of payment has resulted in the moon rental for the current month being * revoked. */ foreach($moon as $rental) { //Setup the rental date, paid until date, and today's date as functions of Carbon library $rentedUntil = new Carbon($rental->rental_until); $paidUntil = new Carbon($rental->paid_until); //If the paid date is larger than the rental date, then update the rental date if($paidUntil->greaterThan($rentedUntil)) { AllianceMoonRental::where([ 'region' => $rental->region, 'system' => $rental->system, 'planet' => $rental->planet, 'moon' => $rental->moon, ])->update([ 'rental_until' => $rental->paid_until, ]); } //If the paid date is today or less, then update the paid column of the moon as not paid if($paidUntil->greaterThanOrEqualTo($today)) { AllianceMoonRental::where([ 'region' => $rental->region, 'system' => $rental->system, 'planet' => $rental->planet, 'moon' => $rental->moon, ])->update([ 'paid' => 'No', ]); } } } }