<?php namespace Database\Factories; use App\Models\Meme; use App\Models\User; use App\Models\Address; use Illuminate\Database\Eloquent\Factories\Factory; class MemeFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Meme::class; private static $address_id = 1; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'user_id' => User::all()->random()->id, 'address_id' => self::$address_id++, 'title' => $this->faker->sentence($nbWords = 3, $variableNbWords = true), 'image' => 'blah.png', ]; } }