<?php

namespace App\Models\Traits;

use Illuminate\Support\Facades\Storage;

trait HasOneCover
{

    /**
     * 拼接图片全地址
     *
     * @return string
     * @author 玄尘 2020-03-05
     */
    public function getCoverPathAttribute(): ?string
    {
        if ($this->cover) {
            return Storage::url($this->cover);
        } else {
            return '';
        }
    }

    /**
     * Notes: 获取标签
     *
     * @Author: 玄尘
     * @Date: 2022/6/28 15:25
     * @return string|null
     */
    public function getLabelPathAttribute(): ?string
    {
        if ($this->label) {
            return Storage::url($this->label);
        } else {
            return '';
        }
    }

}
