1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-14 20:31:22 +08:00
2020-07-20 20:08:51 +08:00

37 lines
821 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;
use 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();
}
}