| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App\Admin\Actions\Problem;
- use App\Models\User;
- use App\Models\UserProblemModel;
- use Dcat\Admin\Contracts\LazyRenderable;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Widgets\Form;
- use PHPUnit\Util\Exception;
- class DoReply extends Form implements LazyRenderable
- {
- use LazyWidget;
- public function __construct($data = [], $key = null)
- {
- parent::__construct($data, $key);
- }
- public function handle(array $input)
- {
- $problem = UserProblemModel::query()->find($input['id']);
- if(!$problem){
- return $this->response()->error('请刷新后重试');
- }
- if(empty($input['reply'])){
- return $this->response()->error('请输入回复内容');
- }
- $problem->status = 1;
- $problem->reply = $input['reply'];
- $problem->save();
- return $this->response()->success('保存成功')->refresh();
- }
- public function form()
- {
- $this->hidden('id')->value($this->payload['id']);
- $this->textarea('reply', '回复内容');
- }
- }
|