<?php

namespace App\Models\Traits;

use Illuminate\Support\Facades\Storage;

trait HasOneCover
{

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

}
