Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
643 B
PHP
29 lines
643 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class WorkspaceSwitchController extends Controller
|
|
{
|
|
/**
|
|
* Switch the current workspace.
|
|
*/
|
|
public function __invoke(Request $request): RedirectResponse
|
|
{
|
|
$workspaceId = $request->input('workspace_id');
|
|
|
|
$user = $request->user();
|
|
$hasAccess = $user->workspaces()->where('workspaces.id', $workspaceId)->exists();
|
|
|
|
if (! $hasAccess) {
|
|
return back();
|
|
}
|
|
|
|
$request->session()->put('current_workspace_id', (int) $workspaceId);
|
|
|
|
return back();
|
|
}
|
|
}
|