<?php

namespace App\Admin\Renderable\Log;

use App\Models\Log;
use Encore\Admin\Widgets\Table;
use Illuminate\Contracts\Support\Renderable;

class InData implements Renderable
{

    public function render($key = null)
    {
        $log       = Log::find($key);
        $in_source = $log->in_source;
        foreach ($in_source as $key => $item) {
            if (!in_array($key, [])) {

            }
            if (is_array($item)) {
                $in_source[$key] = json_encode($item);
            }
        }
    
        if (is_array($in_source) && count($in_source) > 1) {
            $table = new Table(['名称', '值'], $in_source, ['panel', ' panel-default']);

            return $table->render();
        }
    }

}