<?php

namespace App\Admin\Actions\User;

use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

class RefD3Key extends RowAction
{
    public $name = '刷新D3key';

    public function handle(Model $model)
    {
        $model->des3key = Str::random(24);
        $model->save();
        return $this->response()->success('操作成功')->refresh();
    }

    public function dialog()
    {
        $this->confirm('确定要刷新D3key吗？');
    }
}
