Step 01: Creating fresh laravel project
composer create-project laravel/laravel miniecommerce
Step 02: Setting Up migration, factory and seeder of User model
// migration file public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->integer('role_id'); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); }
// UserFactory.php file public function definition() { return [ 'name' => $this->faker->name(), 'role_id' => rand(1,2), 'email' => $this->faker->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'remember_token' => Str::random(10), ]; }
// artisan command php artisan make:seeder UserSeeder
// UserSeeder.php file public function run() { // User::factory(2)->create(); }