From b94c39923f9e53b031a29024b1b0e5414e18fa04 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 30 May 2021 18:01:27 +0900 Subject: [PATCH] import moons --- .../Commands/Files/ImportAllianceMoons.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/Files/ImportAllianceMoons.php b/app/Console/Commands/Files/ImportAllianceMoons.php index c58ad672a..e536f556e 100644 --- a/app/Console/Commands/Files/ImportAllianceMoons.php +++ b/app/Console/Commands/Files/ImportAllianceMoons.php @@ -55,25 +55,32 @@ class ImportAllianceMoons extends Command */ public function handle() { + ///universe/moons/{moon_id}/ + //Declare variables $lookup = new LookupHelper; //Create the collection of lines for the input file. $moons = new Collection; - ///universe/moons/{moon_id}/ - //Create the file handler $data = Storage::get('public/alliance_moons.txt'); //Split the string into separate arrays based on the line $lines = preg_split("/\n/", $data); - + //Take each line and split it again by tabs foreach($lines as $temp) { + //Split the lines into separate arrays by tabs $separated = preg_split("/\t/", $temp); + //Push the tabbed array into the collection $moons->push($separated); } + //Start working our way through all of the moons + //and saving the data to the database foreach($moons as $moon) { - + if($moon[0] != null) { + //Test print + printf($moon[0] . "\r\n"); + } } dd();