<?php
/**
 * Created by PhpStorm.
 * User: zilongs
 * Date: 20-10-4
 * Time: 下午7:11
 */

namespace App\Models;

class ServicePack extends BaseModel
{
    protected $appends = ['label_texts'];
    protected $table = 'service_packs';
    protected $casts = [
        'label' => 'json',
        'team_id' => 'json'
    ];

    public function getLabelTextsAttribute()
    {
        $data = [];
        if (!empty($this->label)) {
            $map = config('config.pack_label_map');
            foreach ($this->label as $k => $v) {
                $data[$k]['name'] = $map[$v]??'';
            }
        }

        return $data;
    }
}
