remove usernames

This commit is contained in:
2023-05-08 10:40:48 +10:00
parent 7a4f72378d
commit ac2dd23ad7
43 changed files with 372 additions and 864 deletions

View File

@@ -20,14 +20,12 @@ class UserFactory extends Factory
$faker = \Faker\Factory::create();
$faker->addProvider(new \Faker\Provider\CustomInternetProvider($faker));
$username = $faker->unique()->userNameWithMinLength(6);
$first_name = $faker->firstName();
$last_name = $faker->lastName();
$display_name = $faker->randomElement([$username, $first_name . ' ' . $last_name]);
$display_name = $first_name . ' ' . $last_name;
return [
'username' => $username,
'first_name' => $first_name,
'last_name' => $last_name,
'email' => $faker->safeEmail(),

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('username')->unique();
});
DB::table('users')->update(['username' => DB::raw('display_name')]);
}
};

View File

@@ -20,7 +20,7 @@ class DatabaseSeeder extends Seeder
\App\Models\User::factory(40)->create();
\App\Models\User::factory()->create([
'username' => 'nomadjimbob',
'display_name' => 'James Collins',
'first_name' => 'James',
'last_name' => 'Collins',
'email' => 'james@stemmechanics.com.au',