<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Good extends Model
{
    protected $guarded = [];
    public static $templetOption = [
        [
            'id' => 1,
            'name' => '农药模板-张洲',
            'value' => 'nongyao'
        ],
        [
            'id' => 2,
            'name' => '种子模板-禾美乐',
            'value' => 'hemeile'
        ],
        [
            'id' => 3,
            'name' => '种子模板-玉米',
            'value' => 'yumi'
        ],
        [
            'id' => 4,
            'name' => '种子模板-小麦',
            'value' => 'xiaomai'
        ],
        [
            'id' => 5,
            'name' => '印刷厂-小麦',
            'value' => 'yinshua'
        ],
        [
            'id' => 6,
            'name' => '刑总-玉米',
            'value' => 'xzyumi'
        ],
    ];


    public function getYouxiaoAttribute($path)
    {
        if (!\Storage::disk('admin')->exists($path)) return '';
        if (\Illuminate\Support\Str::startsWith($path, ['http://', 'https://'])) {
            return $path;
        }
        return \Storage::disk('admin')->url($path);
    }
}
