connection = 'redis'; } /** * Execute the job. * * @return void */ public function handle() { //Declare the helper for moon calculations $moonHelper = new MoonCalc; //Get all the moons from the rental database $moons = AllianceRentalMoon::all(); /** * Calculate the worth of each moon along with the rental prices. * For all of the moon calculations, the price of the mineral is averaged, * thereby, the price of the moon worth is also averaged based on the averaging * of the mineral price. */ foreach($moons as $rental) { //Calculate the total worth of the moon $totalWorth = $moonHelper->SpatialMoonsTotalWorth( $rental->first_ore, $rental->first_quantity, $rental->second_ore, $rental->second_quantity, $rental->third_ore, $rental->third_quantity, $rental->fourth_ore, $rental->fourth_quantity, ); //Calculate the rental prices of the moon $rentalPrice = $moonHelper->SpatialMoons( $rental->first_ore, $rental->first_quantity, $rental->second_ore, $rental->second_quantity, $rental->third_ore, $rental->third_quantity, $rental->fourth_ore, $rental->fourth_quantity, ); //Update the moon in the database AllianceRentalMoon::where([ 'region' => $rental->region, 'system' => $rental->system, 'planet' => $rental->planet, 'moon' => $rental->moon, ])->update([ 'moon_worth' => $totalWorth, 'alliance_rental_price' => $rentalPrice['alliance'], 'out_of_alliance_rental_price' => $rentalPrice['outofalliance'], ]); } } }