Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 25, 2018 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/d6cd7256e3dc581398c61ea11b7991dd to your computer and use it in GitHub Desktop.
Save uno-de-piera/d6cd7256e3dc581398c61ea11b7991dd to your computer and use it in GitHub Desktop.
<?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