Skip to content

Commit

Permalink
fix support sort and rating
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 18, 2024
1 parent 9424a46 commit de74446
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/Docs/V1/Admin/Controllers/Customers/ReviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,18 @@ public function get()
* example="approved",
* enum={"pending", "approved", "disapproved"}
* ),
* required={"status"}
* @OA\Property(
* property="rating",
* description="Review's rating",
* type="integer",
* example="5"
* ),
* @OA\Property(
* property="sort",
* description="Review's sort",
* type="integer",
* example="1"
* ),
* )
* )
* ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ public function resource(): string
public function update(int $id)
{
$this->validate(request(), [
'status' => 'required|in:approved,disapproved,pending',
'status' => 'in:approved,disapproved,pending',
"rating" => "numeric|min:1|max:5",
"sort" => "numeric|min:1|max:100",
]);

Event::dispatch('customer.review.update.before', $id);

$review = $this->getRepositoryInstance()->update(request()->only(['status']), $id);
$review = $this->getRepositoryInstance()->update(request()->only(['status','sort','rating']), $id);

Event::dispatch('customer.review.update.after', $review);

Expand Down

0 comments on commit de74446

Please sign in to comment.