import moons
This commit is contained in:
@@ -61,6 +61,9 @@ class ImportAllianceMoons extends Command
|
|||||||
//Create the collection of lines for the input file.
|
//Create the collection of lines for the input file.
|
||||||
$moons = new Collection;
|
$moons = new Collection;
|
||||||
|
|
||||||
|
AllianceMoon::truncate();
|
||||||
|
AllianceMoonOre::truncate();
|
||||||
|
|
||||||
//Create the file handler
|
//Create the file handler
|
||||||
$data = Storage::get('public/alliance_moons.txt');
|
$data = Storage::get('public/alliance_moons.txt');
|
||||||
//Split the string into separate arrays based on the line
|
//Split the string into separate arrays based on the line
|
||||||
@@ -85,6 +88,20 @@ class ImportAllianceMoons extends Command
|
|||||||
foreach($moons as $moon) {
|
foreach($moons as $moon) {
|
||||||
//If the first array is null then we are dealing with an ore
|
//If the first array is null then we are dealing with an ore
|
||||||
if($moon[0] == null) {
|
if($moon[0] == null) {
|
||||||
|
$moonInfo = $lookup->GetMoonInfo($moon[6]);
|
||||||
|
$solarName = $lookup->SolarSystemIdToName($moonInfo->system_id);
|
||||||
|
|
||||||
|
//Save the moon into the database
|
||||||
|
$newMoon = new AllianceMoon;
|
||||||
|
$newMoon->moon_id = $moonInfo->moon_id;
|
||||||
|
$newMoon->name = $moonInfo->name;
|
||||||
|
$newMoon->system_id = $moonInfo->system_id;
|
||||||
|
$newMoon->system_name = $solarName;
|
||||||
|
$newMoon->worthAmount = 0.00;
|
||||||
|
$newMoon->rented = 'No';
|
||||||
|
$newMoon->rentalAmount = 0.00;
|
||||||
|
$newMoon->save();
|
||||||
|
|
||||||
//Save a new entry into the database
|
//Save a new entry into the database
|
||||||
$ore = new AllianceMoonOre;
|
$ore = new AllianceMoonOre;
|
||||||
$ore->moon_id = $moon[6];
|
$ore->moon_id = $moon[6];
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class CreateNewMoonRentalTables extends Migration
|
|||||||
Schema::create('alliance_moon_ores', function (Blueprint $table) {
|
Schema::create('alliance_moon_ores', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('moon_id');
|
$table->unsignedBigInteger('moon_id');
|
||||||
$table->string('moon_name')->nullable();
|
$table->string('moon_name');
|
||||||
$table->unsignedBigInteger('ore_type_id');
|
$table->unsignedBigInteger('ore_type_id');
|
||||||
$table->string('ore_name');
|
$table->string('ore_name');
|
||||||
$table->float('quantity');
|
$table->float('quantity');
|
||||||
|
|||||||
Reference in New Issue
Block a user