hash_file('sha256',$s['root'].'/single-material-perimeter.json')]); config(['sgf_single_installation.enabled'=>true,'sgf_single_installation.ledger_enabled'=>true,'sgf_single_installation.schema_sha256'=>$host->table('sgf_composition_schema')->value('source_hash'),'sgf_single_installation.profiles_sha256'=>App\Shared\Installation\SyntheticProfiles::fingerprint(App\Shared\Installation\SyntheticProfiles::policy()),'sgf_single_installation.bindings_sha256'=>$pins['single-bindings.json']]); $checks=[];$ok=function($v,$name)use(&$checks,$work){if(!$v)throw new RuntimeException($name);$checks[]=$name;file_put_contents($work.'/ledger-progress.json',json_encode($checks));}; $tokens=['accounting_prepare'=>'fixed-preparer-generation','accounting_review'=>'fixed-reviewer-generation','read_only'=>'fixed-reader-generation']; $call=function($role,$action,Closure $fn)use($app,$profiles,$f,$tokens){ Auth::forgetGuards();Auth::shouldUse('web');$user=App\Models\User::findOrFail($profiles[$role]['user_id']);Auth::guard('web')->setUser($user); $session=app('session')->driver();$session->start();$session->put('company_context',$f['scope']+['token'=>$tokens[$role],'module_id'=>'accounting']);$r=Illuminate\Http\Request::create('/api/general-ledger','GET');$r->attributes->set('sgf_module','accounting');$r->setLaravelSession($session);$r->setUserResolver(fn()=>$user);$app->instance('request',$r);app(CompanyContext::class)->selectFor($user->id,$f['tenant'],$f['company'],$f['unit']); try{return app(ComposedLedger::class)->run($action,$fn);}finally{app(CompanyContext::class)->clear();} };