create(); $azmayesh = Azmayesh::factory()->create(); $response = $this->actingAs($user)->postJson(route('v3.azmayeshes.delete', [$azmayesh->id])); $response->assertForbidden(); } public function test_user_can_delete_azmayesh(): void { $user = User::factory() ->has(Permission::factory([ 'name' => 'azmayesh-management' ])) ->create(); $azmayesh = Azmayesh::factory()->create(); $response = $this->actingAs($user)->postJson(route('v3.azmayeshes.delete', [$azmayesh->id])); $response->assertOk(); $this->assertDatabaseMissing('azmayeshes', [ 'lat' => $azmayesh->lat, 'lng' => $azmayesh->lng, 'azmayesh_type_id' => $azmayesh->azmayesh_type_id, 'azmayesh_type_name' => $azmayesh->azmayesh_type_name, 'request_date' => $azmayesh->request_date, 'report_date' => $azmayesh->report_date, 'request_number' => $azmayesh->request_number, 'employer' => $azmayesh->employer, 'contractor' => $azmayesh->contractor, 'work_number' => $azmayesh->work_number, 'project_name' => $azmayesh->project_name, 'consultant' => $azmayesh->consultant, 'applicant' => $azmayesh->applicant, 'province_id' => $azmayesh->province_id, 'province_name' => $azmayesh->province_name, ]); } }