1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-29 13:51:37 +08:00
2020-08-06 20:53:30 +08:00

42 lines
878 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->checkEditPriv($consult, $user);
$data = [];
if (isset($post['question'])) {
$data['question'] = $validator->checkQuestion($post['question']);
}
if (isset($post['private'])) {
$data['private'] = $validator->checkPrivateStatus($post['private']);
}
$consult->update($data);
return $consult;
}
}