From 8d6546208489d5cc630b18557f960236b2d71547 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Mon, 8 Jan 2018 09:02:55 -0600 Subject: [PATCH] Add news tables and models #52 --- .../2018_01_08_142204_create_news_table.php | 29 +++++++++++++++++ app/Database/seeds/sample.yml | 16 ++++++++++ app/Models/News.php | 32 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 app/Database/migrations/2018_01_08_142204_create_news_table.php create mode 100644 app/Models/News.php diff --git a/app/Database/migrations/2018_01_08_142204_create_news_table.php b/app/Database/migrations/2018_01_08_142204_create_news_table.php new file mode 100644 index 00000000..bf385f6e --- /dev/null +++ b/app/Database/migrations/2018_01_08_142204_create_news_table.php @@ -0,0 +1,29 @@ +increments('id'); + $table->unsignedInteger('user_id'); + $table->string('subject'); + $table->text('body'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('news'); + } +} diff --git a/app/Database/seeds/sample.yml b/app/Database/seeds/sample.yml index 7c086c11..da1eb80b 100644 --- a/app/Database/seeds/sample.yml +++ b/app/Database/seeds/sample.yml @@ -85,6 +85,22 @@ ranks: auto_approve_manual: 1 auto_promote: 0 +news: + - id: 1 + user_id: 1 + subject: Some VA News! + body: > + Lorem Ipsum is simply dummy text of the printing and + typesetting industry. Lorem Ipsum has been the industry's + standard dummy text ever since the 1500s, when an unknown + printer took a galley of type and scrambled it to make a + type specimen book. It has survived not only five centuries, + but also the leap into electronic typesetting, remaining + essentially unchanged. It was popularised in the 1960s with + the release of Letraset sheets containing Lorem Ipsum passages, + and more recently with desktop publishing software like + Aldus PageMaker including versions of Lorem Ipsum. + airports: - id: KAUS iata: AUS diff --git a/app/Models/News.php b/app/Models/News.php new file mode 100644 index 00000000..4d3bf0d1 --- /dev/null +++ b/app/Models/News.php @@ -0,0 +1,32 @@ + 'required', + 'body' => 'required', + ]; + + /** + * FOREIGN KEYS + */ + + public function user() + { + return $this->belongsTo(User::class, 'user_id'); + } +}