This commit is contained in:
2021-10-14 11:54:38 +08:00
parent ad0f7b25a1
commit 14011f9674
2 changed files with 17 additions and 10 deletions

View File

@@ -40,14 +40,17 @@ class Category extends Model
}
/**
* 关联的数据
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description]
* Notes: description
* @Author: 玄尘
* @Date : 2021/10/14 11:53
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo|\Illuminate\Database\Eloquent\Relations\HasMany|null
*/
public function relations()
{
switch ($this->type) {
case self::TYPE_SHOW:
return $this->hasOne(Article::class)->where('id', $this->article_id);
return $this->belongsTo(Article::class);
// return $this->hasOne(Article::class);
break;
case self::TYPE_ARTICLE:
// return $this->belongsToMany(Article::class);

View File

@@ -385,7 +385,11 @@
<div class="row">
@if(getCateChild(73))
@foreach(getCateChild(73) as $cate)
<div class="col-xs-12 col-md-3">
<div class="col-xs-12 col-md-3"
@if($cate->url && $cate->type=='link')
data-href="{{ $cate->url }}"
@endif
/>
<div class="modularEight-label"
style="background-image: url({{ $cate->cover_url }});">
<div class="modularEight-title">{{ $cate->title }}</div>