12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Admin\Actions\Form;
- use App\Models\Account;
- use Dcat\Admin\Contracts\LazyRenderable;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Widgets\Form;
- class ResetPasswordForm extends Form implements LazyRenderable
- {
- use LazyWidget;
- //弹窗表单
- public function form()
- {
- $id = isset($this->payload['id']) ? $this->payload['id'] : 0;
- $this->hidden('id')->value($id);
- $this->password('password', '密码')->required();
- }
- //点击表单处理
- public function handle(array $input)
- {
- try {
- $account = Account::find($input['id']);
- $account->password = \Hash::make($input['password']);;
- $account->save();
- } catch (\Exception $exception) {
- return $this->response()->error($exception->getMessage());
- }
- return $this->response()->success('success')->refresh();
- }
- }
|