mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-15 21:02:20 +08:00
38 lines
749 B
PHP
38 lines
749 B
PHP
<?php
|
|
|
|
namespace App\Services\Frontend\Consult;
|
|
|
|
use App\Services\Frontend\ConsultTrait;
|
|
use App\Services\Frontend\Service as FrontendService;
|
|
use App\Validators\Consult as ConsultValidator;
|
|
|
|
class ConsultRating extends FrontendService
|
|
{
|
|
|
|
use ConsultTrait;
|
|
|
|
public function handle($id)
|
|
{
|
|
$post = $this->request->getPost();
|
|
|
|
$user = $this->getLoginUser();
|
|
|
|
$consult = $this->checkConsult($id);
|
|
|
|
$validator = new ConsultValidator();
|
|
|
|
$validator->checkOwner($user->id, $consult->user_id);
|
|
|
|
$validator->checkIfAllowRate($consult);
|
|
|
|
$rating = $validator->checkRating($post['rating']);
|
|
|
|
$consult->rating = $rating;
|
|
|
|
$consult->update();
|
|
|
|
return $consult;
|
|
}
|
|
|
|
}
|