Related
I want to use the painless script to group the response received after running the index. I want to group the response based on the group_id tag and return other tags also. So far, I have used the following script:
{
"size": 0,
"_source": true,
"aggs": {
"entity_group_aggregations": {
"terms": {
"field": "group_id",
"order": {
"_term": "asc"
}
}
}
}
}
However, this script is not returning the desired output.
My index response looks like the following
{
"hits": {
"total": {
"value": 8693,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "entity_group",
"_type": "_doc",
"_id": "100000003628-brokerAssignment-Outbound-100000000483-aldera",
"_score": 1.0,
"_source": {
"interaction_id": 100000000483,
"group_id": "AFV0001789",
"dest_status": "success",
"group_effective_date": "2021-11-30T18:30:00.000Z",
"exception_cause": "",
"executed_dest_json": [
{
"Type": "Validation",
"name": "validateGroupCountry",
"group": "sequence2",
"sequence": 20,
"resultType": "success",
"status": "processed",
"description": "Validation for group country.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductName",
"group": "sequence2",
"sequence": 21,
"resultType": "success",
"status": "processed",
"description": "Validation for product name.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductEffectiveDate",
"group": "sequence2",
"sequence": 22,
"resultType": "success",
"status": "processed",
"description": "Validation for product effective date.",
"resultReason": "Success"
}
],
"file_name": "brokerAssignment",
"no_of_records": 3,
"di_source": "everwellNgl",
"group_name": "CLAXTON HOBBS PHARMACY - MPA7",
"src_status": "success",
"acknowlegment_record": "{\"groupReturn\": [{\"EB ID#\": \"3391F2D6-3035-11EC-B867-DA6E058A38F8\", \" Group Number\": \"dev-MPA7\", \"Dental Group Rating EE\": null, \"Vision Group Rating EE\": \"5.7\", \"Dental Group Rating FAM\": null, \"Everwell Dental Plan ID\": \"\", \"Everwell Vision Plan ID\": \"11964\", \"Vision Group Rating FAM\": \"16.66\", \" Dental Group Number\": \"\", \" Vision Group Number\": \"AFV0001789\", \"Dental Group Rating EE+CH\": null, \"Dental Group Rating EE+SP\": null, \"Vision Group Rating EE+CH\": \"11.96\", \"Vision Group Rating EE+SP\": \"11.4\", \"Dental Minimum Participation Met\": \"\", \"Vision Minimum Participation Met\": \"Y\"}]}",
"pre_br_canonical": {
"groupDetail": {
"contacts": [
{
"faxNumbers": [
{
"faxNumber": "7702272428",
"type": "primary"
}
],
"firstName": null,
"lastName": null,
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": "7702272428"
}
],
"emailAddresses": [
{
"emailAddress": null,
"type": "primary"
}
],
"type": "group"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "billingfn",
"lastName": "billingln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "contaclmail5343234#gmail.com",
"type": "primary"
}
],
"type": "billing"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "contactfn",
"lastName": "contactln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "akajjamiapin#empoweredbenefits.com",
"type": "primary"
}
],
"type": "admin"
}
],
"transactionType": "A",
"marketer": null,
"ein": null,
"products": [
{
"plans": [
{
"planTakeOverFlag": "N",
"paymentDetail": null,
"networkID": null,
"otherInsuranceCoverageId": null,
"terminationDate": "11-30-2022",
"rating": {
"financialCode": null,
"rateTimeBasis": null,
"rateEffectiveDate": null,
"rateTerminationDate": null,
"coverageTierCode": null,
"initialRateGuaranteePeriod": null,
"rateByCoverageCode": [
{
"maxAge": null,
"rateAmount": "5.7",
"coverageCode": "EMP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.4",
"coverageCode": "ESP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.96",
"coverageCode": "ECH",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "16.66",
"coverageCode": "FAM",
"gender": null,
"minAge": null
}
],
"initialRateGuaranteePeriodType": null,
"rateTableId": null
},
"effectiveDate": "12-01-2021",
"planId": null,
"minParMet": null,
"contract": null,
"planYearType": null,
"enrolledLives": 2,
"externalPlanId": "11964",
"eligibilityValidationCode": null
}
],
"renewalDate": null,
"renewalTimeValue": null,
"product": "VIS",
"terminationDate": null,
"effectiveDate": null,
"renewalTimeBasis": null
}
],
"websiteUrl": null,
"groupName": "HOBBS PHARMACY - MPA7",
"signingProducer": {
"lastName": "agentln",
"email": "agentmailfsd2345#gmail.com",
"firstName": "agentfn",
"writingNumber": "ad126"
},
"tin": "331057747",
"associatedBrokers": [
{
"brokerId": "A123",
"brokerLastName": "Kazhamiakin",
"systemLob": null,
"primaryAgent": null,
"brokerNpn": "15341",
"customLob": null,
"terminationDate": null,
"effectiveDate": "10-18-2021",
"brokerFirstName": "Alex",
"agency": {
"agencyName": null,
"agencyId": null,
"agreementType": null
},
"commissionDetail": {
"agentLevel": null,
"commission": null,
"commissionType": "2",
"commissionPlan": null
},
"splitPercentage": "100"
}
],
"source": "EverwellGroupsetup_20211108155000_Test1.csv",
"groupType": "NGL",
"division": null,
"sicCode": "5912",
"addresses": [
{
"line1": "131 W TAYLOR ST",
"zip": "30223",
"line2": null,
"city": "GRIFFIN",
"state": "GA",
"type": "group",
"country": "US"
},
{
"line1": null,
"zip": null,
"line2": null,
"city": null,
"state": null,
"type": "billing",
"country": "US"
}
],
"businessLevel": null
},
"groupIds": [
{
"system": "everwell",
"parentId": null,
"id": "3391F2D6-3035-11EC-B867-DA6E058A38F8"
},
{
"system": "",
"parentId": null,
"id": "dev-MPA7"
},
{
"system": "",
"parentId": null,
"id": null
}
],
"groupEligibilityDetail": {
"nextRenewalDate": "12-01-2022",
"terminationDate": null,
"groupStatus": null,
"effectiveDate": "12-01-2021",
"lastRenewalDate": null,
"eligibleLives": 9,
"terminationReason": null
},
"groupConfigurations": {
"billingConfiguration": {
"billingFrequency": "M",
"paymentType": null,
"billingParameters": [
{
"billCheckDigit": null,
"paymentType": null,
"applyAutoCash": null,
"terminationDate": null,
"effectiveDate": null,
"invoiceTimingType": null,
"invoiceBasisDateType": null,
"numberOfDaysPriorACH": null,
"invoiceType": null,
"billingParameterIds": [
{
"system": "aldera",
"parentId": null,
"id": null,
"previousId": null
}
]
}
]
},
"miscellaneousConfiguration": {
"preferredLanguage": null,
"orthoMaxInitialPaymentAmount": null,
"orthoInitialPayment": null,
"erApplicationPDFfileName": "71650_CLAXTON_HO.pdf",
"programNumber": null,
"orthoMaxAdditionalPaymentAmount": null,
"orthoPaymentType": null
},
"memberEligibilityConfiguration": {
"cobValidDays": null,
"memberVerificationFrequency": null,
"memberEligibilityFrequency": null,
"memberBenefitExtensionDays": null,
"idCardProductionParmeter": null,
"memberVerificationSource": null,
"waitingMonths": 1,
"memberEligibilityType": null,
"bigLoadAutoGenMemberID": null,
"coverageCodeCalculation": null
},
"groupEligibilityConfiguration": {
"renewalNotificationDays": null,
"memberEligibilityRequired": null,
"cascadeTermToMembers": null,
"retroNumberOfPeriods": null,
"fullTimeEligibilityHours": 11,
"runOutDays": null,
"retroTimePeriodType": null,
"cascadeTermToSubGroups": null
},
"ratingConfiguration": {
"financialCode": null,
"rateTimeBasis": null,
"renewalTimeValue": null,
"rateTableDescription": null,
"genderRated": null,
"coverageTierId": null,
"renewalTimeBasis": null,
"rateTableId": null
}
}
},
"source_status": "warning",
"#version": "1",
"state": "processed",
"source_interaction_type": "sftp",
"processed_date": "2021-12-27T13:48:08.000Z",
"destination_response_result": null,
"exception_cause_source": "",
"destination": "aldera",
"file_interaction_type": "Outbound",
"dest_transaction_id": 3383,
"product": "vision",
"process": "Group",
"initialized_time": "2021-12-27T13:56:44.000Z",
"minparmet": "1",
"received_date": "2021-12-26T18:30:00.000Z",
"group_state": "GA",
"transaction_type": "add",
"destination_response_record": null,
"latest_transaction_date": "2021-12-27T13:48:08.000Z",
"source_file_id": 853,
"record_id": 100000003628,
"status": "success",
"#timestamp": "2022-08-05T10:23:49.002Z",
}
}
]
}
}
Using JSONPath I'm trying to fetch channels > "id": "6af38171-867c-414f-a128-6668fc66cd20" based on provided productId from different request
Example 1: for "productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a", channel id should be "id": "29b13081-760a-4451-81d8-25f0944b3658",
Example 2: for "productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9", channel id should be "id": "6af38171-867c-414f-a128-6668fc66cd20",
Example 3: for "productId": "321ecc29f29-bc03-41d7-b107-db3be8103216", channel id should be "id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
productId picked randomly from the previous request
$..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id which is coming as paramter $..[?(#.promotionRule.promotionProducts[0].productId=="${je_productId}" )].id
Payload
{
"error": null,
"data": [
{
"id": "c0c18687-26cc-48da-b60a-d386279d1c3e",
"channels": [
{
"id": "29b13081-760a-4451-81d8-25f0944b3658",
"promotionRule": {
"id": "18f84232-7350-4f9f-8037-7e92eebbc4d4",
"promotionProducts": [
{
"id": "2d755bfe-8b8f-4b2a-9bf4-e8e626975b51",
"productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "8291365c-df9f-4d7b-8f34-be0b500065ee",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5161071+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5152919+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:37:15.5168274+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": null,
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "100%",
"channelGroupLogo": "https://123/media/100percentlogo.png",
"channelGroupLogoHD": "https://123/media/100percentlogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "e2de2a1f-a21b-41db-82c0-a5710cf59dee",
"channels": [
{
"id": "6af38171-867c-414f-a128-6668fc66cd20",
"promotionRule": {
"id": "074eced6-9894-4313-85e2-2a04965fc8eb",
"promotionProducts": [
{
"id": "b93ccce2-171b-4e4e-83d7-fd77632acb4f",
"productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "a3d14456-64cb-4cae-b749-133c4b6a476a",
"options": null
},
{
"description": "Play Type",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "d50aeef2-4821-4247-b712-585a2ba55f81",
"options": null
},
{
"description": "Front Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "ed6a4930-2558-414d-b47f-a3f95e719f60",
"options": null
},
{
"description": "Middle Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e0957685-22d8-4827-a3db-a1e2e0b5b76b",
"options": null
},
{
"description": "Back Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "98b3c77a-bb25-4a45-a2ca-c90a79c75ecb",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7837463+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7829809+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T20:17:01.7844511+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Pick 3",
"channelGroupLogo": "https://123/brandmedia/AcmePick3.png",
"channelGroupLogoHD": "https://123/brandmedia/AcmePick3.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "b234c6b1-ffba-4883-ae9a-d6483b4787ab",
"channels": [
{
"id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
"promotionRule": {
"id": "863b5465-d5ab-4433-bea2-2b0d4da0cfcc",
"promotionProducts": [
{
"id": "c5031107-3995-48d0-8f26-95597531e7e4",
"productId": "321ecc29f29-bc03-41d7-b107-db3be8103216",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "db7ae266-bf79-4d63-984a-aea1aa7af460",
"options": null
},
{
"description": "White Ball - 1",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "8b750179-6ead-425e-b5a2-ab422e72a03e",
"options": null
},
{
"description": "White Ball - 2",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "3a87a9aa-d8c8-465a-ae35-f7d894204b13",
"options": null
},
{
"description": "White Ball - 3",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "6b674bc4-1143-4558-8020-88872064b6d2",
"options": null
},
{
"description": "White Ball - 4",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "0cf02fdf-c717-4ea0-a230-cb837792e7f5",
"options": null
},
{
"description": "White Ball - 5",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e627485b-eb3b-4afe-a20d-bed5c30ba195",
"options": null
},
{
"description": "Powerball",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e4c6e609-954a-4707-88b5-c47993fb3f82",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9594038+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9586017+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:44:42.9601687+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Powerball",
"channelGroupLogo": "https://123/brandmedia/PowerballLogo.png",
"channelGroupLogoHD": "https://123/brandmedia/PowerballLogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
]
}
"Your" $..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id expression works fine for me (given I add 321 to the beginning to match response data
If it doesn't work for you - check the ${je_productId} JMeter Variable value using Debug Sampler and View Results Tree listener combination
Also be aware that JMeter Variables are not being evaluated in the "JSON Path Tester" mode of the View Results Tree listener mainly because they don't exist there.
I am new to web development , and trying to create a dashboard with laravel , and trying to pass my data to laravel but i am not being able to do this, i getting above error,
Trying to get property 'count' of non-object
So, How can i retrieve count data and users data in my views,
Here is my controller:
public function dashboard()
{
$countActiveUser = User::where('status',0)->get();
$countLatestUser = User::latest()->get();
$countBlockedUser = User::where('status',1)->get();
$countTotalUser = User::all();
$dataCount['activeUserCount'] = count($countActiveUser);
$dataCount['blockedUserCount'] = count($countBlockedUser);
$dataCount['latestUserCount'] = count($countLatestUser);
$dataCount['allUserCount'] = count($countTotalUser);
$data['users']=$countTotalUser;
$data['count']=$dataCount;
return view('dashboard',['data'=>$data,]);
}
and here is how i trying to retrive my values in dashboard.blade\
<span class="h2 font-weight-bold mb-0">{{$data->count->activeUserCount}}</span>
return data:
{
"data": {
"user": [
{
"id": 1,
"name": "user0",
"email": "nabrajkhadka43#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 2,
"name": "user1",
"email": "email1#gmail.com",
"phone": null,
"email_verified_at": "Apr 15 2020",
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": "Apr 22 2020"
},
{
"id": 3,
"name": "user2",
"email": "email2#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 4,
"name": "user3",
"email": "email3#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 5,
"name": "user4",
"email": "email4#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 6,
"name": "user5",
"email": "email5#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 7,
"name": "user6",
"email": "email6#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 8,
"name": "user7",
"email": "email7#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 9,
"name": "user8",
"email": "email8#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 10,
"name": "user9",
"email": "email9#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": null
},
{
"id": 24,
"name": "hari Khadka",
"email": "password#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": "2020-04-01-1324237408.jpg",
"lat": null,
"lon": null,
"bio": null,
"created_at": "Apr 01 2020"
},
{
"id": 26,
"name": "hari Khadka",
"email": "emaiasdl1#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": "2020-04-10-1742149546.jpg",
"lat": null,
"lon": null,
"bio": null,
"created_at": "Apr 10 2020"
},
{
"id": 27,
"name": "alfredaosd",
"email": "nabrajkhssadka43#gmail.com",
"phone": null,
"email_verified_at": null,
"profile_pic_url": null,
"lat": null,
"lon": null,
"bio": null,
"created_at": "Apr 10 2020"
}
],
"count": {
"activeUserCount": 9,
"blockedUserCount": 4,
"latestUserCount": 13,
"allUserCount": 13
}
}
}
i know this is a duplicate question but please some on help me.
use code below to see in your view blade:
<span class="h2 font-weight-bold mb-0">{{$data['count']['activeUserCount']}}</span>
to get users one by one in your blade:
<table>
<tr>
#foreach($data['user'] as $user)
<td>{{ $user['id'] }}</td>
<td>{{ $user['name'] }}</td>
#endforeach
</tr>
</table>
Use Following code.
$countActiveUser = User::query()->where('status',0)->count();
$countLatestUser = User::query()->latest()->count();
$countBlockedUser = User::query()->where('status',1)->count();
$countTotalUser = User::all()->count();
It WIll return count in integer.
I am using the below code:
$greatDeals = $greatDealsinitial->sortBy(function ($deal, $key) {
return $deal->hotel->room[0]->price;
});
Here room is an array, I want to sort this collection by price in the room array.
But I can't use return $row->hotel->room->price;
So how can I sort this?
my collection :
[
{
"id": 2,
"hotel_id": 1,
"deal_code": "sfg",
"date": "2018-04-13 00:00:00",
"discount": 12,
"status": 1,
"created_at": "2018-04-13 11:21:18",
"updated_at": "2018-04-13 11:21:18",
"deleted_at": null,
"client_id": 1,
"hotel": {
"id": 1,
"name": "Aloft Dongguan Songshan Lake",
"address": "Dongguan, China, 511700",
"phone": "76982106666",
"country": "101",
"country_name": "India",
"state": "35",
"state_name": "Tamil Nadu",
"city": "3551",
"city_name": "Abiramam",
"area": null,
"pincode": "511700",
"nearest_airport": null,
"nearest_railway": null,
"star": null,
"check_in": null,
"check_out": null,
"lat": "22.929869",
"lng": "113.89232800000002",
"description": null,
"astatus": "1",
"status": "0",
"created_at": "2018-04-13 10:27:30",
"updated_at": "2018-04-13 10:27:48",
"client_id": 1,
"hotel_age": null,
"hotel_privilege": "asdf",
"departure": "sdaf",
"checkout_fee": "asdf",
"book_policy": "sadf",
"hotel_secured": null,
"hotel_pets": null,
"hotel_other": null,
"room": [
{
"id": 3,
"roomtype_id": 2,
"room_count": null,
"max_adult": 2,
"max_children": 1,
"capacity": 3,
"room_number": null,
"floor": null,
"number": null,
"name": null,
"city_name": "Abiramam",
"city": 3551,
"price": "200.00",
"extra_bed_price": null,
"astatus": "1",
"status": "0",
"created_at": "2018-04-13 12:37:11",
"updated_at": "2018-04-13 12:37:52",
"deleted_at": null,
"client_id": 1,
"hotel_id": 1
},
{
"id": 1,
"roomtype_id": 1,
"room_count": null,
"max_adult": 2,
"max_children": 1,
"capacity": 3,
"room_number": null,
"floor": null,
"number": null,
"name": null,
"city_name": "Abiramam",
"city": 3551,
"price": "435.00",
"extra_bed_price": null,
"astatus": "1",
"status": "0",
"created_at": "2018-04-13 10:33:24",
"updated_at": "2018-04-13 11:21:38",
"deleted_at": null,
"client_id": 1,
"hotel_id": 1
}
]
}
},
{
"id": 4,
"hotel_id": 2,
"deal_code": "ertgerf",
"date": "2018-04-13 00:00:00",
"discount": 1,
"status": 1,
"created_at": "2018-04-13 11:47:39",
"updated_at": "2018-04-13 11:53:45",
"deleted_at": null,
"client_id": 2,
"hotel": {
"id": 2,
"name": "Temperance Lane",
"address": "Temperance Ln, Sydney NSW 2000, Australia",
"phone": "9842814927",
"country": "14",
"country_name": "Austria",
"state": "281",
"state_name": "Carinthia",
"city": "6843",
"city_name": "Maria Rain",
"area": "test",
"pincode": "2000",
"nearest_airport": "demo",
"nearest_railway": "test",
"star": null,
"check_in": "09:30 AM",
"check_out": "04:30 PM",
"lat": "-33.86963590000001",
"lng": "151.20667979999996",
"description": "test description",
"astatus": "1",
"status": "0",
"created_at": "2018-04-13 10:43:16",
"updated_at": "2018-04-13 11:41:25",
"client_id": 2,
"hotel_age": null,
"hotel_privilege": "testtesttesttesttesttesttesttesttesttesttest",
"departure": "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
"checkout_fee": "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
"book_policy": "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
"hotel_secured": null,
"hotel_pets": null,
"hotel_other": "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
"room": [
{
"id": 2,
"roomtype_id": 1,
"room_count": null,
"max_adult": 2,
"max_children": 3,
"capacity": 5,
"room_number": null,
"floor": null,
"number": null,
"name": null,
"city_name": "Maria Rain",
"city": 6843,
"price": "345.00",
"extra_bed_price": null,
"astatus": "1",
"status": "0",
"created_at": "2018-04-13 10:46:04",
"updated_at": "2018-04-13 10:47:05",
"deleted_at": null,
"client_id": 2,
"hotel_id": 2
}
]
}
}
]
This sorts the rooms of each hotel per price:
$greatDealsinitial->each(function($deal) {
$deal->hotel->setRelation('room', $deal->hotel->room->sortBy('price'));
});
$greatDeals = $greatDealsinitial->hotel->room->sortBy('price')
if this array looks
[
['price' => 0],
['price' => 1],
['price' => 3]
]
I'm getting the error "object field starting or ending with a [.] makes object resolution ambiguous: []". But there isn't a single dot [.] in my object. Using elasticClient.update() I'm passing:
{
"index": "applicants",
"type": "applicant",
"id": "A01gfGEBKfWmu0nhvuR7",
"body": {
"doc": {
"phsEmploymentHistory": {
"numSickDaysNotIll": "4",
"employers": [{
"employmentType": {},
"": {},
"name": null,
"supervisor": null,
"contactNumber": null,
"extension": null,
"email": null,
"coworker1": null,
"coworker2": null,
"duties": null,
"jobTitle": null,
"reasonLeaving": null,
"fullTime": null,
"partTime": null,
"temp": null,
"selfEmployed": null,
"volunteer": null,
"duration": {
"startDate": null,
"endDate": null
},
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"agencies": [{
"": {},
"agencyName": null,
"backgroundInvestigator": null,
"contactNumber": null,
"extension": null,
"position": null,
"email": null,
"stepsCompleted": null,
"dateApplied": null,
"status": null,
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"disciplined": {
"response": false,
"explanation": ""
},
"warnedDrugs": {
"response": false,
"explanation": ""
},
"valid": true
}
}
}
}
I've been over this several times. I don't think the error message is adequate. The "object resolution ambiguous: []" seems to hint that I have an empty array, but I don't.
Values of the json could be empty. But if the keys are empty then ES throws error while indexing.
Remove "":{} from the json and index again.
Reference:
https://discuss.elastic.co/t/object-field-starting-or-ending-with-a-makes-object-resolution-ambiguous/123351