add a pirep_comments table
This commit is contained in:
@@ -87,6 +87,11 @@ class Pirep extends Model
|
|||||||
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function comments()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\PirepComment', 'pirep_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function events()
|
public function events()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\PirepEvent', 'pirep_id');
|
return $this->hasMany('App\Models\PirepEvent', 'pirep_id');
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Eloquent as Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PirepEvent
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class PirepComment extends Model
|
||||||
|
{
|
||||||
|
public $table = 'pirep_comments';
|
||||||
|
|
||||||
|
public $fillable
|
||||||
|
= [
|
||||||
|
'comment',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validation rules
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $rules
|
||||||
|
= [
|
||||||
|
'comment' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pirep()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Pirep', 'pirep_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,6 +42,14 @@ class CreatePirepsTable extends Migration
|
|||||||
$table->index('arr_airport_id');
|
$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) {
|
Schema::create('pirep_events', function(Blueprint $table) {
|
||||||
$table->bigIncrements('id')->unsigned();
|
$table->bigIncrements('id')->unsigned();
|
||||||
$table->uuid('pirep_id');
|
$table->uuid('pirep_id');
|
||||||
|
|||||||
Reference in New Issue
Block a user