测试
This commit is contained in:
@@ -40,14 +40,17 @@ class Category extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联的数据
|
* Notes: description
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description]
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/14 11:53
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo|\Illuminate\Database\Eloquent\Relations\HasMany|null
|
||||||
*/
|
*/
|
||||||
public function relations()
|
public function relations()
|
||||||
{
|
{
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case self::TYPE_SHOW:
|
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;
|
break;
|
||||||
case self::TYPE_ARTICLE:
|
case self::TYPE_ARTICLE:
|
||||||
// return $this->belongsToMany(Article::class);
|
// return $this->belongsToMany(Article::class);
|
||||||
|
|||||||
@@ -385,17 +385,21 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
@if(getCateChild(73))
|
@if(getCateChild(73))
|
||||||
@foreach(getCateChild(73) as $cate)
|
@foreach(getCateChild(73) as $cate)
|
||||||
<div class="col-xs-12 col-md-3">
|
<div class="col-xs-12 col-md-3"
|
||||||
<div class="modularEight-label"
|
@if($cate->url && $cate->type=='link')
|
||||||
style="background-image: url({{ $cate->cover_url }});">
|
data-href="{{ $cate->url }}"
|
||||||
<div class="modularEight-title">{{ $cate->title }}</div>
|
@endif
|
||||||
</div>
|
/>
|
||||||
|
<div class="modularEight-label"
|
||||||
|
style="background-image: url({{ $cate->cover_url }});">
|
||||||
|
<div class="modularEight-title">{{ $cate->title }}</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user