create(); test()->actingAs($user); $case = ClientCase::factory()->create(['active' => 1]); $typeId = DB::table('contract_types')->insertGetId([ 'name' => 'Standard', 'description' => 'Test', 'created_at' => now(), 'updated_at' => now(), ]); $contract = $case->contracts()->create([ 'uuid' => (string) Str::uuid(), 'reference' => 'T-TEST', 'start_date' => now()->toDateString(), 'end_date' => null, 'type_id' => $typeId, 'active' => 1, ]); ArchiveSetting::factory()->create([ 'entities' => [ ['table' => 'contracts', 'conditions' => ['where' => ['client_case_id' => $case->id]]], ], 'strategy' => 'immediate', 'soft' => true, 'enabled' => true, ]); test()->post(route('clientCase.contract.archive', [$case->uuid, $contract->uuid])) ->assertRedirect(); $contract->refresh(); expect($contract->active)->toBe(0); });