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>
35 lines
891 B
PHP
35 lines
891 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Models\FolderInvitation;
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class ValidateFolderInvitation
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
$token = $request->route('token');
|
|
|
|
$invitation = FolderInvitation::query()
|
|
->where('token', $token)
|
|
->with(['folder.client', 'folder.assignee', 'folder.creator'])
|
|
->first();
|
|
|
|
if (! $invitation || ! $invitation->isValid()) {
|
|
abort(404, 'Lien invalide ou expiré.');
|
|
}
|
|
|
|
$request->attributes->set('folder_invitation', $invitation);
|
|
|
|
return $next($request);
|
|
}
|
|
}
|