jonnybarnes.uk/database/factories/ModelFactory.php
Jonny Barnes 2b5e17ab4e Squashed commit of the following:
commit 7daedd241246bd11f371a8c93394796f8f5ec4cb
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Aug 11 21:01:17 2017 +0100

    Bring in the latest changes from upstream repo laravel/laravel
2017-08-11 21:02:03 +01:00

32 lines
1,007 B
PHP

<?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.
|
*/
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
});
$factory->define(App\Note::class, function (Faker\Generator $faker) {
return [
'note' => $faker->paragraph,
'tweet_id' => $faker->randomNumber(9),
'facebook_url' => 'https://facebook.com/' . $faker->randomNumber(9),
];
});