Files
SGF/scripts/direct-cost-fixture.php
T
2026-10-27 12:26:52 +02:00

11 lines
1.0 KiB
PHP

<?php
require __DIR__.'/../vendor/autoload.php';
$app=require __DIR__.'/../bootstrap/app.php';$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
\App\Modules\Workshop\DirectCosts::guard();
$file='C:/laragon/data/sgf-tempo/secrets/browser-fixture.json';$base=json_decode(file_get_contents($file),true,32,JSON_THROW_ON_ERROR);
if(\Illuminate\Support\Facades\DB::table('wo_orders')->exists()||\Illuminate\Support\Facades\DB::table('dc_rates')->exists())throw new RuntimeException('Fresh isolated proof required; nothing deleted.');
$f=\Tests\Support\DirectCostFixture::create($base+['manager'=>\App\Models\User::findOrFail($base['manager_id']),'reader'=>\App\Models\User::findOrFail($base['reader_id'])]);
$safe=array_intersect_key($f,array_flip(['order','time','material','day','task','auth']));
file_put_contents($file,json_encode($base+['direct_costs'=>$safe],JSON_THROW_ON_ERROR));
echo "Verified workshop sources prepared via existing commands in sgf_tempo_test. Cost rates/calculations are empty; no copied operational events.\n";