adds roles
This commit is contained in:
@@ -30,7 +30,6 @@ public function definition(): array
|
||||
'status' => 'in_progress',
|
||||
'score' => null,
|
||||
'result' => null,
|
||||
'basic_info' => null,
|
||||
'additional_comments' => null,
|
||||
'completed_at' => null,
|
||||
];
|
||||
|
||||
32
database/migrations/0000_00_00_000000_create_roles_table.php
Normal file
32
database/migrations/0000_00_00_000000_create_roles_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$now = now();
|
||||
|
||||
DB::table('roles')->insert([
|
||||
['name' => 'user', 'created_at' => $now, 'updated_at' => $now],
|
||||
['name' => 'admin', 'created_at' => $now, 'updated_at' => $now],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@@ -13,10 +13,16 @@ public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('role_id')->default(1)->constrained();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('azure_id')->nullable()->unique();
|
||||
$table->string('photo')->nullable();
|
||||
$table->string('job_title')->nullable();
|
||||
$table->string('department')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('password')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ public function up(): void
|
||||
$table->string('status', 50)->default('in_progress');
|
||||
$table->integer('score')->nullable();
|
||||
$table->string('result', 50)->nullable();
|
||||
$table->json('basic_info')->nullable();
|
||||
$table->text('additional_comments')->nullable();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class JonathanSeeder extends Seeder
|
||||
final class JonathanSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
* Seed the application's database with admin user Jonathan.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$adminRole = Role::where('name', 'admin')->first();
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Jonathan',
|
||||
'email' => 'jonathan@blijnder.nl',
|
||||
'password' => bcrypt('secret'),
|
||||
'email_verified_at' => now(),
|
||||
'role_id' => $adminRole->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user