-
-
Save uno-de-piera/d6cd7256e3dc581398c61ea11b7991dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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