From e772c195a6f5469e62921252adb96c43c3c03619 Mon Sep 17 00:00:00 2001 From: Ghostie Date: Tue, 20 Aug 2024 20:20:11 -0500 Subject: [PATCH] created post model, factory, and migration --- app/Models/Post.php | 11 +++++++ database/factories/PostFactory.php | 23 +++++++++++++ .../2024_08_21_011536_create_posts_table.php | 33 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 app/Models/Post.php create mode 100644 database/factories/PostFactory.php create mode 100644 database/migrations/2024_08_21_011536_create_posts_table.php diff --git a/app/Models/Post.php b/app/Models/Post.php new file mode 100644 index 0000000..089656b --- /dev/null +++ b/app/Models/Post.php @@ -0,0 +1,11 @@ + + */ +class PostFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/2024_08_21_011536_create_posts_table.php b/database/migrations/2024_08_21_011536_create_posts_table.php new file mode 100644 index 0000000..82ab2aa --- /dev/null +++ b/database/migrations/2024_08_21_011536_create_posts_table.php @@ -0,0 +1,33 @@ +id(); + + $table->string("title"); + $table->text("description"); + $table->string("image"); + $table->foreignId("user_id")->constrained()->onDelete("cascade"); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + } +};