Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
use Faker\Generator as Faker;
class GenerateRandomUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'generator:random_user';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This command generates a random user with Faker every minute';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @param Faker $faker
* @return mixed
*/
public function handle(Faker $faker)
{
User::create([
'name' => $faker->name,
'email' => $faker->email,
'password' => bcrypt($faker->password(6))
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment