Skip to content

Instantly share code, notes, and snippets.

@deleugpn
Created October 28, 2017 16:56
Show Gist options
  • Select an option

  • Save deleugpn/9ec5b8ee5de25bf2f4da96a350b83570 to your computer and use it in GitHub Desktop.

Select an option

Save deleugpn/9ec5b8ee5de25bf2f4da96a350b83570 to your computer and use it in GitHub Desktop.
<?php
use App\Models\Main\User;
use App\Models\Main\Company;
use Faker\Generator as Faker;
$factory->define(User::class, function (Faker $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'company_id' => factory(Company::class)
];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment