We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3224626 commit a752acbCopy full SHA for a752acb
src/Traits/ReviewRateable.php
@@ -332,6 +332,19 @@ public function totalReviews(bool $approved = true): int
332
return $this->reviews()->where('approved', $approved)->count();
333
}
334
335
+ /**
336
+ * Get the total number of reviews for the model.
337
+ *
338
+ * @param bool $approved
339
+ * @return int
340
+ */
341
+ public function totalDepartmentReviews(string $department, bool $approved = true): int
342
+ {
343
+ return $this->reviews()
344
+ ->where('department', $department)
345
+ ->where('approved', $approved)->count();
346
+ }
347
+
348
/**
349
* Calculate the overall average rating for all ratings across all reviews,
350
* optionally filtering by the approved status.
0 commit comments