diff options
author | Mateja <mail@matejamaric.com> | 2020-10-19 21:49:52 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-10-19 21:49:52 +0200 |
commit | df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d (patch) | |
tree | 633e79739070907987c6f8b9943b0df79e85054e /database/factories/PostFactory.php | |
parent | 45fe556c8a62918a97d7d50e5bbcb6bd6190ae7d (diff) | |
download | yota-laravel-df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d.tar.gz yota-laravel-df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d.zip |
Add factory for posts.
Diffstat (limited to 'database/factories/PostFactory.php')
-rw-r--r-- | database/factories/PostFactory.php | 30 |
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, + ]; + } +} |