From 7cde58f6f67383e23e206c56aa1aa8bfeec89a99 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 24 Jun 2017 13:23:30 -0500 Subject: [PATCH] DatabaseService cleanup --- app/Services/DatabaseService.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Services/DatabaseService.php b/app/Services/DatabaseService.php index d52620c7..92c2234e 100644 --- a/app/Services/DatabaseService.php +++ b/app/Services/DatabaseService.php @@ -11,7 +11,12 @@ use Illuminate\Support\Facades\DB; class DatabaseService extends BaseService { - protected $uuid_tables = [ + protected static $time_fields = [ + 'created_at', + 'updated_at' + ]; + + protected static $uuid_tables = [ 'flights', 'pireps', 'users', @@ -30,7 +35,6 @@ class DatabaseService extends BaseService public function seed_from_yaml($yml) { - $time_fields = ['created_at', 'updated_at']; $yml = Yaml::parse($yml); foreach ($yml as $table => $rows) { foreach ($rows as $row) { @@ -49,7 +53,7 @@ class DatabaseService extends BaseService } # if any time fields are == to "now", then insert the right time - foreach($time_fields as $tf) { + foreach($this->time_fields as $tf) { if(array_key_exists($tf, $row) && $row[$tf] === 'now') { $row[$tf] = $this->time(); }