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 # Relations
## AircraftManufacturers ## AircraftManufacturer
- HasMany AircraftType - HasMany AircraftType
## AircraftTypes ## AircraftType
- BelongsTo AircraftManufacturers - BelongsTo AircraftManufacturer
- **TODO** BelongsTo Typeratings (External DB) - BelongsTo Typerating (External DB, creation in Schooling Plugin)
- HasMany Aircrafts - HasMany Aircraft
## Aircrafts ## Aircraft
- BelongsTo AircraftTypes - BelongsTo AircraftType
- BelongsToMany AircraftTypeGroups - BelongsToMany AircraftTypeGroup
- **TODO** BelongsTo Airports (External DB, Multiple) - **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 * @var array Validation rules
*/ */
public $rules = [ public $rules = [
'aircraft_manufacturer' => 'required', 'aircraft_manufacturer_id' => 'required',
'typerating_id' => 'required', 'typerating_id' => 'required',
'only_charter' => 'required', 'only_charter' => 'required',
'type' => 'required', 'type' => 'required',
@ -52,6 +52,7 @@ class AircraftType extends Model
public $belongsTo = [ public $belongsTo = [
'aircraft_manufacturer' => 'GermanAirlinesVa\Fleet\Models\AircraftManufacturer', 'aircraft_manufacturer' => 'GermanAirlinesVa\Fleet\Models\AircraftManufacturer',
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
]; ];
public $belongsToMany = [ public $belongsToMany = [

View File

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

View File

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

View File

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

View File

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