#21 FK wiring
This commit is contained in:
@@ -68,14 +68,9 @@ class Pirep extends Model
|
|||||||
* Foreign Keys
|
* Foreign Keys
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function user()
|
public function arr_airport()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\User', 'user_id');
|
return $this->belongsTo('App\Models\Airport', 'arr_airport_id');
|
||||||
}
|
|
||||||
|
|
||||||
public function flight()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('App\Models\Flight', 'flight_id');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dpt_airport()
|
public function dpt_airport()
|
||||||
@@ -83,9 +78,19 @@ class Pirep extends Model
|
|||||||
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function arr_airport()
|
public function fields()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Airport', 'arr_airport_id');
|
return $this->hasMany('App\Models\PirepFieldValues', 'pirep_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function flight()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Flight', 'flight_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\User', 'user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,13 @@ class PirepFieldValues extends Model
|
|||||||
= [
|
= [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Foreign Keys
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function pirep()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Pirep', 'pirep_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ class User extends Authenticatable
|
|||||||
return $this->belongsTo('App\Models\Airport', 'curr_airport_id');
|
return $this->belongsTo('App\Models\Airport', 'curr_airport_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pireps()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Pirep', 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function rank()
|
public function rank()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Rank', 'rank_id');
|
return $this->belongsTo('App\Models\Rank', 'rank_id');
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class CreateUsersTable extends Migration
|
|||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
|
|
||||||
|
$table->index('email');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create table for storing roles
|
// Create table for storing roles
|
||||||
|
|||||||
Reference in New Issue
Block a user