From 93786835afee96d0391d96346a26d7bb7d7a3a8b Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 2 Jan 2018 11:23:38 -0600 Subject: [PATCH] get the generated IDs from the middle of the sha1 hash --- app/Database/factories/AcarsFactory.php | 2 +- app/Database/factories/FlightFactory.php | 2 +- app/Database/factories/PirepFactory.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Database/factories/AcarsFactory.php b/app/Database/factories/AcarsFactory.php index 12dc5b34..34f212bd 100644 --- a/app/Database/factories/AcarsFactory.php +++ b/app/Database/factories/AcarsFactory.php @@ -4,7 +4,7 @@ use Faker\Generator as Faker; $factory->define(App\Models\Acars::class, function (Faker $faker) { return [ - 'id' => substr($faker->unique()->sha1, 0, 12), + 'id' => substr($faker->unique()->sha1, 28, 12), 'pirep_id' => '', # fill this out by 'log' => $faker->text(200), 'lat' => $faker->latitude, diff --git a/app/Database/factories/FlightFactory.php b/app/Database/factories/FlightFactory.php index 0a5be937..e996b49d 100644 --- a/app/Database/factories/FlightFactory.php +++ b/app/Database/factories/FlightFactory.php @@ -8,7 +8,7 @@ $airlinesAvailable = [1]; $factory->define(App\Models\Flight::class, function (Faker $faker) use ($airlinesAvailable) { return [ - 'id' => substr($faker->unique()->sha1, 0, 12), + 'id' => substr($faker->unique()->sha1, 28, 12), 'airline_id' => $faker->randomElement($airlinesAvailable), 'flight_number' => $faker->unique()->text(10), 'route_code' => $faker->randomElement(['', $faker->text(5)]), diff --git a/app/Database/factories/PirepFactory.php b/app/Database/factories/PirepFactory.php index 0718fab0..3a1ed5ae 100644 --- a/app/Database/factories/PirepFactory.php +++ b/app/Database/factories/PirepFactory.php @@ -10,7 +10,7 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) { static $raw_data; return [ - 'id' => substr($faker->unique()->sha1, 0, 12), + 'id' => substr($faker->unique()->sha1, 28, 12), 'airline_id' => function () { # OVERRIDE THIS IF NEEDED return factory(App\Models\Airline::class)->create()->id; },