Typerating FK and editor changes to match

This commit is contained in:
Gogs 2021-06-14 00:06:07 +02:00
parent d2d57fdb78
commit f01610d30d
6 changed files with 29 additions and 26 deletions

View File

@ -1,23 +1,21 @@
# Relations
## AircraftManufacturers
## AircraftManufacturer
- HasMany AircraftType
## AircraftTypes
## AircraftType
- BelongsTo AircraftManufacturers
- **TODO** BelongsTo Typeratings (External DB)
- HasMany Aircrafts
- BelongsTo AircraftManufacturer
- BelongsTo Typerating (External DB, creation in Schooling Plugin)
- HasMany Aircraft
## Aircrafts
## Aircraft
- BelongsTo AircraftTypes
- BelongsToMany AircraftTypeGroups
- **TODO** BelongsTo Airports (External DB, Multiple)
- BelongsTo AircraftType
- BelongsToMany AircraftTypeGroup
- **TODO** BelongsTo Airport (External DB)
## AircraftTypeGroups
## AircraftTypeGroup
- BelongsToMany AircraftTypes
---
- BelongsToMany AircraftType

View File

@ -25,7 +25,7 @@ class AircraftType extends Model
* @var array Validation rules
*/
public $rules = [
'aircraft_manufacturer' => 'required',
'aircraft_manufacturer_id' => 'required',
'typerating_id' => 'required',
'only_charter' => 'required',
'type' => 'required',
@ -52,6 +52,7 @@ class AircraftType extends Model
public $belongsTo = [
'aircraft_manufacturer' => 'GermanAirlinesVa\Fleet\Models\AircraftManufacturer',
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
];
public $belongsToMany = [

View File

@ -2,12 +2,16 @@ columns:
id:
label: id
type: text
aircraft_manufacturers_id:
label: aircraft_manufacturers_id
type: number
typerating_id:
label: typerating_id
type: number
aircraft_manufacturer:
label: aircraft_manufacturer
relation: aircraft_manufacturer
type: text
valueFrom: name
typerating:
label: typerating
relation: typerating
type: text
valueFrom: name
only_charter:
label: only_charter
type: text

View File

@ -8,11 +8,13 @@ tabs:
required: 1
type: relation
tab: 'germanairlinesva.fleet::lang.aircraft_types.tabs.operational'
typerating_id:
typerating:
label: 'germanairlinesva.fleet::lang.aircraft_types.typerating_id'
nameFrom: name
descriptionFrom: description
span: auto
required: 1
type: number
type: relation
tab: 'germanairlinesva.fleet::lang.aircraft_types.tabs.operational'
only_charter:
label: 'germanairlinesva.fleet::lang.aircraft_types.only_charter'

View File

@ -19,6 +19,8 @@ class BuilderTableCreateGermanAirlinesVaAircraftManufacturers extends Migration
public function down()
{
Schema::connection('germanairlinesva_fleet')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_fleet')->dropIfExists('aircraft_manufacturers');
Schema::connection('germanairlinesva_fleet')->enableForeignKeyConstraints();
}
}

View File

@ -17,10 +17,6 @@ class BuilderTableCreateGermanAirlinesVaAircraftTypes extends Migration
->references('id')
->on('aircraft_manufacturers');
$table->bigInteger('typerating_id')->unsigned();
//$table
// ->foreign('typerating_id')
// ->references('id')
// ->on('typeratings');
$table->boolean('only_charter');
$table->string('type');
$table->text('description');