<?php

namespace App\Admin\Actions\backstage\User;

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

class MapDepot extends RowAction
{
    public $name = '病例图库';

    public function form(Model $model)
    {
        $imgs = OrderPatient::where('patient_id',$model->patient_id)->get('medical_imgs');
        $all = json_decode($imgs,true);
        $i =1;
        $all1 =  array_column($all,'medical_imgs');
//        dd($all1);
        foreach ($all1 as $val)
        {
//            dd($val);
            if (is_array($val) || is_object($val))
            {
                foreach ($val as $value1){
//                dd($value1);
                    $this->image('name'.$i)->value($value1);
                    $i++;
//                echo $value1."<br>";
                }
            }

//            dd($value1);
        }
    }

}