1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-29 05:41:37 +08:00
2020-07-26 20:32:52 +08:00

38 lines
760 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 ConsultUpdate 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->owner_id);
$validator->checkIfAllowEdit($consult);
$question = $validator->checkQuestion($post['question']);
$consult->question = $question;
$consult->update();
return $consult;
}
}