hypothetical/database/factories/ModelFactory.php

24 lines
702 B
PHP
Raw Normal View History

<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
2016-08-19 16:38:49 -04:00
$factory->define(App\User::class, function (Faker\Generator $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),
];
});