coinwind/app/Admin/Actions/User/Change.php

25 lines
636 B
PHP

<?php
namespace App\Admin\Actions\User;
use App\Tool\Google;
use Encore\Admin\Actions\RowAction;
use Encore\Admin\Admin;
use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Database\Eloquent\Model;
class Change extends RowAction
{
public $name = '更新谷歌';
public function handle(Model $model)
{
$ga = new Google();
$secrete = $ga->createSecret();
$admin = Administrator::where(array("id" => $model->id))->update([
"secret" => $secrete
]);
return $this->response()->success('新的谷歌密钥为' . $secrete . '可以编辑查看')->refresh();;
}
}