hypothetical/database/factories/UserFactory.php

26 lines
729 B
PHP
Raw Normal View History

<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
2016-08-22 14:34:21 -04:00
static $password;
return [
'name' => $faker->name,
2016-09-22 13:40:58 -04:00
'email' => $faker->unique()->safeEmail,
2016-08-22 14:34:21 -04:00
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
});