1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 13:21:37 +08:00
2020-05-16 19:49:58 +08:00

36 lines
813 B
PHP

<?php
namespace App\Services\Frontend\Review;
use App\Services\Frontend\CourseTrait;
use App\Services\Frontend\ReviewTrait;
use App\Services\Frontend\Service as FrontendService;
use App\Validators\Review as ReviewValidator;
class ReviewUpdate extends FrontendService
{
use CourseTrait, ReviewTrait;
public function handle($id)
{
$post = $this->request->getPost();
$review = $this->checkReview($id);
$user = $this->getLoginUser();
$validator = new ReviewValidator();
$validator->checkOwner($user->id, $review->user_id);
$content = $validator->checkContent($post['content']);
$rating = $validator->checkRating($post['rating']);
$review->content = $content;
$review->rating = $rating;
$review->update();
}
}