aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-10-19 21:49:52 +0200
committerMateja <mail@matejamaric.com>2020-10-19 21:49:52 +0200
commitdf3e709ea53fb9ea34224f3ad42d4f8dbbaf049d (patch)
tree633e79739070907987c6f8b9943b0df79e85054e
parent45fe556c8a62918a97d7d50e5bbcb6bd6190ae7d (diff)
downloadyota-laravel-df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d.tar.gz
yota-laravel-df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d.zip
Add factory for posts.
-rw-r--r--database/factories/PostFactory.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php
new file mode 100644
index 0000000..0b00530
--- /dev/null
+++ b/database/factories/PostFactory.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Database\Factories;
+
+use App\Models\Post;
+use Illuminate\Database\Eloquent\Factories\Factory;
+
+class PostFactory extends Factory
+{
+ /**
+ * The name of the factory's corresponding model.
+ *
+ * @var string
+ */
+ protected $model = Post::class;
+
+ /**
+ * Define the model's default state.
+ *
+ * @return array
+ */
+ public function definition()
+ {
+ return [
+ 'title' => $this->faker->title,
+ 'author' => $this->faker->name,
+ 'text' => $this->faker->text,
+ ];
+ }
+}