fix(route): fix implicit route model binding for Project

- Move Route::model to register() in AppServiceProvider so it persists in route cache
- Re-register in boot() for runtime
- Fix navigation spacing for language/notification/user menu

All 101 tests pass
This commit is contained in:
Javier Braña
2026-08-04 12:18:54 +02:00
parent 16efe381c5
commit f566d370be
3 changed files with 32 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use App\Models\Project;
class BindProjectModel
{
public function handle(Request $request, Closure $next)
{
$route = $request->route();
if ($route && $route->parameter('project')) {
$projectId = $route->parameter('project');
if (is_string($projectId) && is_numeric($projectId)) {
$project = Project::findOrFail($projectId);
$route->setParameter('project', $project);
}
}
return $next($request);
}
}