Example of Factories in driesvints/driesvints.com

File database/factories/PostFactory.php (link to Github)
use App\Models\Post;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Factories\Factory;

class PostFactory extends Factory
    public function definition(): array
        return [
            'slug' => $this->faker->unique()->slug,
            'title' => $this->faker->words(5, true),
            'excerpt' => $this->faker->text(160),
            'content' => $this->faker->text(500),
            'published_at' => $publishedAt = new CarbonImmutable($this->faker->dateTimeBetween('-3 years', 'now')), // Posted between 3 years ago and now.
            'created_at' => $this->faker->dateTimeBetween($publishedAt->subDays(7), $publishedAt), // Created between 7 days before publishing and the day of publication.
            'updated_at' => $this->faker->randomElement([ // Never updated, or on a day between publication date and a month later.
                $this->faker->dateTimeBetween($publishedAt, $publishedAt->addDays(30)),
File database/seeders/PostSeeder.php (link to Github)
use App\Models\Post;
use Illuminate\Database\Seeder;

class PostSeeder extends Seeder
    public function run()

Additional resources on factories: