调整视频详情页
This commit is contained in:
@@ -12,11 +12,25 @@ class Article extends Model
|
||||
|
||||
use HasCovers, BelongsToCategory;
|
||||
|
||||
/**
|
||||
* Notes: 获取详情地址
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/11/29 15:46
|
||||
* @return string
|
||||
*/
|
||||
public function getLinkAttribute(): string
|
||||
{
|
||||
return route('article.show', $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取logo地址
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/11/29 15:46
|
||||
* @return string
|
||||
*/
|
||||
public function getLogoUrlAttribute(): string
|
||||
{
|
||||
return $this->parseImageUrl($this->logo);
|
||||
@@ -24,6 +38,7 @@ class Article extends Model
|
||||
|
||||
/***
|
||||
* Notes: 获取详情内图片
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/10/8 11:58
|
||||
* @return mixed|string
|
||||
@@ -41,6 +56,7 @@ class Article extends Model
|
||||
|
||||
/**
|
||||
* Notes: 获取一个默认图片
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/3 16:29
|
||||
* @return mixed|string
|
||||
@@ -54,7 +70,7 @@ class Article extends Model
|
||||
if ($path) {
|
||||
$this->cover = str_replace("/storage", "", $path);
|
||||
$this->save();
|
||||
$path = config('app.url') . $path;
|
||||
$path = config('app.url').$path;
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +82,7 @@ class Article extends Model
|
||||
|
||||
/**
|
||||
* Notes: 关联分类
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/4/2 9:11
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
@@ -73,7 +90,7 @@ class Article extends Model
|
||||
public function categories(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Category::class)
|
||||
->using(ArticleCategory::class);
|
||||
->using(ArticleCategory::class);
|
||||
}
|
||||
|
||||
public function category(): BelongsTo
|
||||
@@ -88,6 +105,7 @@ class Article extends Model
|
||||
|
||||
/**
|
||||
* Notes: description
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/4/2 9:17
|
||||
* @param $query
|
||||
@@ -96,15 +114,11 @@ class Article extends Model
|
||||
*/
|
||||
public function scopeByCategory($query, $ids)
|
||||
{
|
||||
if (!is_array($ids)) {
|
||||
if (! is_array($ids)) {
|
||||
$ids = [$ids];
|
||||
}
|
||||
|
||||
return $query->whereIn('category_id', $ids);
|
||||
//
|
||||
// return $query->whereHas('categories', function ($q) use ($ids) {
|
||||
// $q->whereIN('id', $ids);
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user