feat: multi-tenant SaaS implementation - admin interface, tenant isolation, and UI updates

This commit is contained in:
jeremy bayse
2026-03-28 18:38:22 +01:00
parent 7d94be7a8c
commit f53d5770df
20 changed files with 757 additions and 34 deletions

View File

@@ -15,10 +15,14 @@ class CandidateController extends Controller
{
public function index()
{
$candidates = Candidate::with(['user', 'documents', 'attempts'])->latest()->get();
$candidates = Candidate::with(['user', 'documents', 'attempts', 'tenant', 'jobPosition'])->latest()->get();
$jobPositions = \App\Models\JobPosition::orderBy('title')->get();
$tenants = \App\Models\Tenant::orderBy('name')->get();
return \Inertia\Inertia::render('Admin/Candidates/Index', [
'candidates' => $candidates
'candidates' => $candidates,
'jobPositions' => $jobPositions,
'tenants' => $tenants
]);
}
@@ -42,8 +46,10 @@ class CandidateController extends Controller
'email' => 'required|string|email|max:255|unique:users',
'phone' => 'nullable|string|max:20',
'linkedin_url' => 'nullable|url|max:255',
'cv' => 'nullable|file|mimes:pdf|max:5120',
'cover_letter' => 'nullable|file|mimes:pdf|max:5120',
'cv' => 'nullable|mimes:pdf|max:5120',
'cover_letter' => 'nullable|mimes:pdf|max:5120',
'tenant_id' => 'nullable|exists:tenants,id',
'job_position_id' => 'nullable|exists:job_positions,id',
]);
$password = Str::random(10);
@@ -51,15 +57,17 @@ class CandidateController extends Controller
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($password),
'password' => Hash::make(Str::random(12)),
'role' => 'candidate',
'tenant_id' => auth()->user()->isSuperAdmin() ? $request->tenant_id : auth()->user()->tenant_id,
]);
$candidate = Candidate::create([
'user_id' => $user->id,
$candidate = $user->candidate()->create([
'phone' => $request->phone,
'linkedin_url' => $request->linkedin_url,
'status' => 'en_attente',
'tenant_id' => auth()->user()->isSuperAdmin() ? $request->tenant_id : auth()->user()->tenant_id,
'job_position_id' => $request->job_position_id,
]);
$this->storeDocument($candidate, $request->file('cv'), 'cv');