<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Good extends Model
{
    public $appends = ['trace'];
    public static $templetOption = [
        [
            'id' => 1,
            'name' => '绿豆模板',
            'value' => 'key'
        ],
        [
            'id' => 2,
            'name' => '玉米模板',
            'value' => 'yumi'
        ],
        [
            'id' => 3,
            'name' => '经销商模板',
            'value' => 'jingxiaoshang'
        ]
    ];

    public function getTraceAttribute()
    {
        return Trace::where('gid', $this->attributes['id'])->count();
    }
}
