From 1953c4dcb56b865711689d27bb86a33615e67e2c Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 2 Aug 2017 10:17:54 -0500 Subject: [PATCH] add a pirep_comments table --- app/Models/Pirep.php | 5 +++ app/Models/PirepComment.php | 35 +++++++++++++++++++ .../2017_06_28_195426_create_pireps_table.php | 8 +++++ 3 files changed, 48 insertions(+) create mode 100644 app/Models/PirepComment.php diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index f2d25ab2..176bddfb 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -87,6 +87,11 @@ class Pirep extends Model return $this->belongsTo('App\Models\Airport', 'dpt_airport_id'); } + public function comments() + { + return $this->hasMany('App\Models\PirepComment', 'pirep_id'); + } + public function events() { return $this->hasMany('App\Models\PirepEvent', 'pirep_id'); diff --git a/app/Models/PirepComment.php b/app/Models/PirepComment.php new file mode 100644 index 00000000..179a8841 --- /dev/null +++ b/app/Models/PirepComment.php @@ -0,0 +1,35 @@ + 'required', + ]; + + public function pirep() + { + return $this->belongsTo('App\Models\Pirep', 'pirep_id'); + } +} diff --git a/database/migrations/2017_06_28_195426_create_pireps_table.php b/database/migrations/2017_06_28_195426_create_pireps_table.php index 44d8b618..ccbe9ff0 100644 --- a/database/migrations/2017_06_28_195426_create_pireps_table.php +++ b/database/migrations/2017_06_28_195426_create_pireps_table.php @@ -42,6 +42,14 @@ class CreatePirepsTable extends Migration $table->index('arr_airport_id'); }); + Schema::create('pirep_comments', function (Blueprint $table) { + $table->bigIncrements('id')->unsigned(); + $table->uuid('pirep_id'); + $table->bigInteger('user_id', false, true); + $table->text('comment'); + $table->timestamps(); + }); + Schema::create('pirep_events', function(Blueprint $table) { $table->bigIncrements('id')->unsigned(); $table->uuid('pirep_id');