<?php

namespace App\Admin\Actions\backstage\Orders;

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

class ServicePackOrderList extends RowAction
{
    public $name = '服务包订单列表';

    public function handle(Model $model)
    {
        $patient_id_arr = OrderPatient::where('order_id',$this->row->id)->pluck('patient_id');
        $patient_id = $patient_id_arr[0];
        $pack_id_arr = OrderPack::where('order_id',$this->row->id)->pluck('service_pack_id');
        $pack_id = $pack_id_arr[0];
        return $this->response()->success('跳转服务包订单列表成功')->redirect('/admin/service_packs_order_list?patient_id='.$patient_id.'&pay_order_pack_id='.$pack_id.'');
    }

}