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');