adds roles

This commit is contained in:
2026-02-16 11:19:06 +01:00
parent ebaeb1722d
commit 4dc64c22cb
29 changed files with 495 additions and 89 deletions

View File

@@ -30,7 +30,6 @@ public function definition(): array
'status' => 'in_progress',
'score' => null,
'result' => null,
'basic_info' => null,
'additional_comments' => null,
'completed_at' => null,
];

View 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');
}
};

View File

@@ -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();
});

View File

@@ -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();

View File

@@ -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,
]);
}
}