<?php
 namespace App\Http\Middleware; use App\Models\Client; use App\Services\Consent\ConsentService; use Closure; use Illuminate\Http\Request; class ResolveConsent { public function handle(Request $request, Closure $next) { $client = auth('client')->check() ? auth('client')->user() : null; $service = new ConsentService( $request, $client instanceof Client ? $client : null ); app()->instance(ConsentService::class, $service); return $next($request); } } 