Fix: New registered candidates visibility (profile creation and tenant scope adjustment)

This commit is contained in:
jeremy bayse
2026-04-16 18:31:23 +02:00
parent 957947cc0b
commit 84a9c6bb14
2 changed files with 10 additions and 1 deletions

View File

@@ -41,6 +41,12 @@ class RegisteredUserController extends Controller
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
'role' => 'candidate',
]);
// Create the associated candidate record so they appear in the lists
$user->candidate()->create([
'status' => 'en_attente',
]);
event(new Registered($user));

View File

@@ -25,7 +25,10 @@ trait BelongsToTenant
}
if ($user->tenant_id) {
$builder->where('tenant_id', $user->tenant_id);
$builder->where(function ($query) use ($user) {
$query->where('tenant_id', $user->tenant_id)
->orWhereNull('tenant_id');
});
}
}
});