<?php

namespace Modules\Mall\Http\Controllers\Admin\Action\Order;

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

class Audit 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();
        }
    }

}