xmrmemes/database/factories/MemeFactory.php

36 lines
745 B
PHP
Raw Normal View History

2021-07-16 02:35:54 -04:00
<?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',
];
}
}