5 lines
627 B
PHP
5 lines
627 B
PHP
<?php require __DIR__.'/boot-QA.php'; use Illuminate\Support\Facades\DB;
|
|
$p=json_decode(file_get_contents(__DIR__.'/PROVA-DELTA-QA.json'),true);$s=$p['scenarios'][0];$doc=DB::table('documents')->where('id',$s['document_id'])->where('uploaded_by',$s['user_id'])->firstOrFail();
|
|
if(($argv[1]??'')==='restore')DB::table('documents')->where('id',$doc->id)->update(['deleted_at'=>null]);else{if($doc->deleted_at)throw new RuntimeException('Already unavailable');DB::table('documents')->where('id',$doc->id)->update(['deleted_at'=>now()]);}
|
|
echo json_encode(['synthetic_document_only'=>true,'restored'=>($argv[1]??'')==='restore']);
|