Example of Factories in tighten/novapackages

File database/factories/PackageFactory.php (link to Github)
use App\Collaborator;
use App\Package;
use Illuminate\Database\Eloquent\Factories\Factory;

class PackageFactory extends Factory
    public function definition()
        return [
            'name' => $this->faker->sentence,
            'url' => "{$this->faker->url}/{$this->faker->slug}",
            'picture_url' => 'https://picsum.photos/380/220/?random',
            'description' => markdown('# '.$this->faker->sentence()."\n\n"
                .implode(' ', $this->faker->sentences(2))."\n\n"
                .implode(' ', $this->faker->sentences(4))),
            'instructions' => markdown('```'.implode(' ', $this->faker->sentences(4)).'```'),
            'author_id' => Collaborator::factory(),
            'composer_name' => $this->faker->slug.'/'.$this->faker->slug,
            'is_disabled' => false,
            'abstract' => $this->faker->text(190),
            'readme' => markdown('# '.$this->faker->sentence."\n\n"
                .implode(' ', $this->faker->sentences(2))."\n\n"
                .implode(' ', $this->faker->sentences(4))),
File database/seeders/DatabaseSeeder.php (link to Github)
use App\Tag;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
    public function run()

        foreach (Tag::PROJECT_TYPES as $name) {
            Tag::create(['name' => $name, 'slug' => Str::slug($name)]);

        // non-type tags
        foreach (collect(['chart', 'form', 'nova']) as $name) {
            Tag::create(['name' => $name, 'slug' => Str::slug($name)]);

        $packages = [
                'name' => 'Nova Package Discovery',
                'abstract' => 'Discover new and popular Nova Packages',
                'composer_name' => 'tightenco/nova-package-discovery',
                'url' => 'https://github.com/tightenco/nova-package-discovery',
                'readme_source' => 'github',
                'readme_format' => 'md',
                'readme' => "# Nova Package Discovery package\n\nDiscover new packages! Check out the ten most recent and most popular packages on NovaPackages.com, and also check out some stats about the number of packages submitted and more.\n \n<img width=\"474\" alt=\"image\" src=\"https://user-images.githubusercontent.com/151829/44622253-14538480-a883-11e8-896c-55b08a5c1280.png\">\n\n \n ## Installation\n\nYou can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:\n\n```bash\ncomposer require tightenco/nova-package-discovery\n```\n\nNext, you must register the card with Nova. This is typically done in the `cards` method of the `NovaServiceProvider`.\n\n```php\n// in app/Providers/NovaServiceProvider.php\n\n// ...\npublic function cards()\n{\n    return [\n        // ...\n        new \\Tightenco\\NovaPackageDiscovery\\NovaPackageDiscovery,\n    ];\n}\n```\n",

Additional resources on factories: