<?php

namespace App\Community\Actions\Nurse;

use App\Models\Order;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;

class Finished extends RowAction
{
    public $name = '完成订单';

    public function handle(Model $model)
    {
        $id = $this->row->order_id;
        $res = Order::where('id',$id)->update(['order_status'=>Order::FINISHED]);
        if($res){
            return $this->response()->success('操作成功!')->refresh();
        }

        return $this->response()->error('操作失败!');
    }

}
