Skip to content

Instantly share code, notes, and snippets.

@prondubuisi
Created January 23, 2019 06:44
Show Gist options
  • Save prondubuisi/93bc3ae54b02c2139bd7f0e36783dc33 to your computer and use it in GitHub Desktop.
Save prondubuisi/93bc3ae54b02c2139bd7f0e36783dc33 to your computer and use it in GitHub Desktop.
<?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) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
$factory->define(App\Product::class, function (Faker $faker) {
return [
'title' => $faker->text(10),
'description' => $faker->word,
'price' => $faker->numberBetween(200,500)
];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment