'Object of type Illuminate\\Http\\Request is not callable, Laravel 8 upload file

Console Log Error

UnitController

is there someone who can help me to solve this problem?



Solution 1:[1]

You can use the Request in the following ways:

request('lastName')
$request->lastName

In line 65 of the attached image, change $request() to request(). Simply remove the dollar sign.

Solution 2:[2]

ProjectionOperation convertAuditTimeToHourOp = Aggregation.project("customId", "viewers", "auditTime")
                .and(StringOperators.Substr.valueOf("auditTime").substring(0, 13))
                .as("auditHour");
                
GroupOperation countOp = Aggregation.group("customId", "auditHour").count().as("averageViewers");
        
ProjectionOperation convertAuditHourToDateOp = Aggregation.project("customId", "averageViewers", "auditHour")
                .and(StringOperators.Concat.valueOf("auditHour").concat(":00:00.000Z")).as("timePeriodString");
        
ProjectionOperation convertTimePeriodToDate = Aggregation.project("customId", "averageViewers", "timePeriodString")
                .and(DateFromString.fromStringOf("timePeriodString"))
                .as("timePeriod");

AggregationResults<Document> aggregate = mongoTemplate.aggregate(
                Aggregation.newAggregation(convertAuditTimeToHourOp, countOp, convertAuditHourToDateOp, convertTimePeriodToDate),
                HistoricEntity.class, 
                Document.class
);

List<Document> mappedResults = aggregate.getMappedResults();

Solution 3:[3]

@indybee

This worked with a little fiddling.

I changed count to average to get the average per hour (sorry dodgy question)

And used the DateOperator to pull Year Month day hour out of it

     ProjectionOperation convertAuditTimeToHourOp = Aggregation.project("channelId", "viewers", "auditTime")
            .and(DateOperators.dateOf("auditTime").toString("%Y-%m-%d-%H"))
            .as("auditHour");

        GroupOperation averageViewers = Aggregation.group("customId", "auditHour").avg("viewers").as("averageViewers");

    ProjectionOperation convertTimePeriodToDate = Aggregation.project("customId", "averageViewers", "auditHour")
            .and(DateOperators.DateFromString.fromStringOf("auditHour"))
            .as("timePeriod");

 ....

Thank you!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BlackPearl
Solution 2 indybee
Solution 3 Adam Meadows