From 524378dcaee41d466cd537f1de0250abfcd11f05 Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Fri, 7 Sep 2018 12:26:52 +0200 Subject: [PATCH] Added account types model and migration. --- app/AccountType.php | 10 +++++ ...9_07_102147_create_account_types_table.php | 43 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 app/AccountType.php create mode 100644 database/migrations/2018_09_07_102147_create_account_types_table.php diff --git a/app/AccountType.php b/app/AccountType.php new file mode 100644 index 0000000..40238ca --- /dev/null +++ b/app/AccountType.php @@ -0,0 +1,10 @@ +increments('id'); + + // The name of the account type + $table->string('name'); + + // The account class to which the account type belongs + $table->integer('account_class_id')->unsigned(); + $table->foreign('account_class_id')->references('id')->on('account_classes') + ->onDelete('restrict'); + + // An unique number of the account type + $table->integer('number')->unique(); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('account_types'); + } +}