<?php

namespace Modules\User\Http\Controllers\Admin\Actions;

use Encore\Admin\Actions\Response;
use Encore\Admin\Actions\RowAction;
use Modules\User\Models\Order;

class Pay extends RowAction
{

    public $name = '支付测试-正式版本移除';

    public function handle(Order $order): Response
    {
        try {
            $order->pay();

            return $this->response()->success('支付状态调整成功')->refresh();
        } catch (\Exception $exception) {
            return $this->response()->error($exception->getMessage())->refresh();
        }
    }

}