From df3e709ea53fb9ea34224f3ad42d4f8dbbaf049d Mon Sep 17 00:00:00 2001 From: Mateja <mail@matejamaric.com> Date: Mon, 19 Oct 2020 21:49:52 +0200 Subject: Add factory for posts. --- database/factories/PostFactory.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 database/factories/PostFactory.php 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, + ]; + } +} -- cgit v1.2.3