diff --git a/app/Console/Commands/Files/ImportAllianceMoons.php b/app/Console/Commands/Files/ImportAllianceMoons.php
index 57eeb3cae..bae903816 100644
--- a/app/Console/Commands/Files/ImportAllianceMoons.php
+++ b/app/Console/Commands/Files/ImportAllianceMoons.php
@@ -17,6 +17,7 @@ use DB;
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper;
+use App\Library\Moon\MoonCalc;
//Models
use App\Models\MoonRental\AllianceMoonOre;
@@ -58,8 +59,9 @@ class ImportAllianceMoons extends Command
///universe/moons/{moon_id}/
//Declare variables
$lookup = new LookupHelper;
+ $mHelper = new MoonCalc;
//Create the collection of lines for the input file.
- $moons = new Collection;
+ $moons = new Collection;
//Create the file handler
$data = Storage::get('public/alliance_moons.txt');
@@ -88,6 +90,8 @@ class ImportAllianceMoons extends Command
$moonInfo = $lookup->GetMoonInfo($moon[6]);
$solarName = $lookup->SystemIdToName($moonInfo->system_id);
+ $moonType = $mHelper->IsRMoonGoo($moon[1]);
+
if(AllianceMoon::where(['moon_id' => $moonInfo->moon_id])->count() == 0) {
//Save the moon into the database
$newMoon = new AllianceMoon;
@@ -95,10 +99,17 @@ class ImportAllianceMoons extends Command
$newMoon->name = $moonInfo->name;
$newMoon->system_id = $moonInfo->system_id;
$newMoon->system_name = $solarName;
+ $newMoon->moon_type = $moonType;
$newMoon->worth_amount = 0.00;
$newMoon->rented = 'No';
$newMoon->rental_amount = 0.00;
$newMoon->save();
+ } else {
+ AllianceMoon::where([
+ 'moon_id' => $moonInfo->moon_id,
+ ])->update([
+ 'moon_type' => $moonType,
+ ]);
}
//Save a new entry into the database
diff --git a/app/Http/Controllers/Test/TestController.php b/app/Http/Controllers/Test/TestController.php
index d3931b098..993102b12 100644
--- a/app/Http/Controllers/Test/TestController.php
+++ b/app/Http/Controllers/Test/TestController.php
@@ -52,7 +52,7 @@ class TestController extends Controller
//Pluck all the users from the database of ledgers to determine if they are mains or alts.
$tempMains = Ledger::where([
- 'invoiced' => 'No',
+ 'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->pluck('character_id');
//Get the unique character ids from the ledgers in the previous statement
@@ -77,14 +77,14 @@ class TestController extends Controller
//Count the ledgers for the main
$mainLedgerCount = Ledger::where([
'character_id' => $main,
- 'invoiced' => 'No',
+ 'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
//If there are ledgers for the main, then let's grab them
if($mainLedgerCount > 0) {
$mainLedgers = Ledger::where([
'character_id' => $main,
- 'invoiced' => 'No',
+ 'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
//Cycle through the entries, and add them to the ledger to send with the invoice
@@ -114,13 +114,13 @@ class TestController extends Controller
foreach($alts as $alt) {
$altLedgerCount = Ledger::where([
'character_id' => $alt->character_id,
- 'invoiced' => 'No',
+ 'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
if($altLedgerCount > 0) {
$altLedgers = Ledger::where([
'character_id' => $alt->character_id,
- 'invoiced' => 'No',
+ 'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
foreach($altLedgers as $row) {
diff --git a/app/Library/Moons/MoonCalc.php b/app/Library/Moons/MoonCalc.php
index ff25dd479..d7ce9d4d9 100644
--- a/app/Library/Moons/MoonCalc.php
+++ b/app/Library/Moons/MoonCalc.php
@@ -501,10 +501,10 @@ class MoonCalc {
*/
private function IsRMoonGoo($ore) {
$ores = [
- 'Zeolites' => 'Gas',
- 'Sylvite' => 'Gas',
- 'Bitumens' => 'Gas',
- 'Coesite' => 'Gas',
+ 'Zeolites' => 'R4',
+ 'Sylvite' => 'R4',
+ 'Bitumens' => 'R4',
+ 'Coesite' => 'R4',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',
@@ -539,10 +539,10 @@ class MoonCalc {
*/
private function IsRMoonOre($ore) {
$ores = [
- 'Zeolites' => 'Gas',
- 'Sylvite' => 'Gas',
- 'Bitumens' => 'Gas',
- 'Coesite' => 'Gas',
+ 'Zeolites' => 'R4',
+ 'Sylvite' => 'R4',
+ 'Bitumens' => 'R4',
+ 'Coesite' => 'R4',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',
diff --git a/database/migrations/2021_05_28_111608_create_new_moon_rental_tables.php b/database/migrations/2021_05_28_111608_create_new_moon_rental_tables.php
index 8db4f2822..e0271471e 100644
--- a/database/migrations/2021_05_28_111608_create_new_moon_rental_tables.php
+++ b/database/migrations/2021_05_28_111608_create_new_moon_rental_tables.php
@@ -32,6 +32,14 @@ class CreateNewMoonRentalTables extends Migration
$table->string('name')->default('Not Assigned');
$table->unsignedBigInteger('system_id');
$table->string('system_name')->default('Not Assigned');
+ $table->enum('moon_type', [
+ 'R4',
+ 'R8',
+ 'R16',
+ 'R32',
+ 'R64',
+ 'None',
+ ])->default('None');
$table->decimal('worth_amount')->default(0.00);
$table->enum('rented', [
'No',
diff --git a/resources/views/test/miningtax/invoice.blade.php b/resources/views/test/miningtax/invoice.blade.php
index f16b1cd44..49f2a0db5 100644
--- a/resources/views/test/miningtax/invoice.blade.php
+++ b/resources/views/test/miningtax/invoice.blade.php
@@ -2,6 +2,6 @@
@section('content')
@foreach($bodies as $body)
-{{ $body }}
+{{ var_dump($body) }}
@endforeach
@endsection
\ No newline at end of file