Alternates
This commit is contained in:
@@ -38,4 +38,13 @@ class Airport extends Model
|
||||
'based' => ['GermanAirlinesVa\Fleet\Models\Aircraft', 'key' => 'home_airport_id'],
|
||||
'occupying' => ['GermanAirlinesVa\Fleet\Models\Aircraft', 'key' => 'airport_id'],
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'alternates' => [
|
||||
'GermanAirlinesVa\Routes\Models\Airport',
|
||||
'table' => 'alternates',
|
||||
'key' => 'airport_id',
|
||||
'otherKey' => 'alternate_id',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php namespace GermanAirlinesVa\Routes\Models;
|
||||
|
||||
use Model;
|
||||
|
||||
/**
|
||||
* Model
|
||||
*/
|
||||
class Alternate extends Model
|
||||
{
|
||||
use \October\Rain\Database\Traits\Validation;
|
||||
|
||||
/*
|
||||
* Disable timestamps by default.
|
||||
* Remove this line if timestamps are defined in the database table.
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'alternates';
|
||||
protected $connection = 'germanairlinesva_routes';
|
||||
|
||||
/**
|
||||
* @var array Validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'airport_id' => 'required',
|
||||
'alternate_id' => 'required',
|
||||
];
|
||||
|
||||
public $belongsTo = [
|
||||
'airport' => ['GermanAirlinesVa\Routes\Models\Airport', 'key' => 'airport_id'],
|
||||
'alternate' => ['GermanAirlinesVa\Routes\Models\Airport', 'key' => 'alternate_id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
columns:
|
||||
id:
|
||||
label: id
|
||||
type: number
|
||||
airport:
|
||||
label: airport
|
||||
type: text
|
||||
relation: airport
|
||||
valueFrom: icao
|
||||
alternate:
|
||||
label: alternate
|
||||
type: text
|
||||
relation: alternate
|
||||
valueFrom: icao
|
||||
index:
|
||||
label: index
|
||||
type: number
|
||||
@@ -0,0 +1,21 @@
|
||||
fields:
|
||||
airport:
|
||||
label: 'germanairlinesva.routes::lang.alternates.airport'
|
||||
nameFrom: icao
|
||||
descriptionFrom: description
|
||||
span: auto
|
||||
required: 1
|
||||
type: relation
|
||||
alternate:
|
||||
label: 'germanairlinesva.routes::lang.alternates.alternate'
|
||||
nameFrom: icao
|
||||
descriptionFrom: description
|
||||
span: auto
|
||||
required: 1
|
||||
type: relation
|
||||
index:
|
||||
label: 'germanairlinesva.routes::lang.alternates.index'
|
||||
span: auto
|
||||
default: '0'
|
||||
required: 1
|
||||
type: number
|
||||
Reference in New Issue
Block a user