Files
new_nyfh/app/Models/Traits/HasOneCover.php
2022-06-29 17:03:47 +08:00

42 lines
720 B
PHP

<?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 '';
}
}
}