小调整
This commit is contained in:
@@ -20,7 +20,7 @@ class CategoryController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$articles = $category->relations(Category::TYPE_ARTICLE)->paginate(8);
|
$articles = $category->relations(Category::TYPE_ARTICLE)->paginate(8);
|
||||||
$parent = $category;
|
$parent = $category;
|
||||||
if ($category->childrens->isEmpty() && $category->patent) {
|
if ($category->childrens->isEmpty() && $category->parent) {
|
||||||
$parent = $category->parent;
|
$parent = $category->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,4 +74,15 @@ class Category extends Model
|
|||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTop()
|
||||||
|
{
|
||||||
|
$parent = $this;
|
||||||
|
|
||||||
|
while ($parent->parent_id) {
|
||||||
|
$parent->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parent;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<div class="pages">
|
<div class="pages">
|
||||||
@if ($articles->isNotEmpty())
|
@if ($articles->isNotEmpty())
|
||||||
{{ $articles->appends(['title'=>request()->title])->links('layouts.pagination') }}
|
{{ $articles->appends(request()->all())->links('layouts.pagination') }}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -253,7 +253,7 @@
|
|||||||
<div class="mian-title">
|
<div class="mian-title">
|
||||||
<b>{{ getOneCategory(18,'title') }}</b>
|
<b>{{ getOneCategory(18,'title') }}</b>
|
||||||
<span>/ {{ getOneCategory(18,'description') }}</span>
|
<span>/ {{ getOneCategory(18,'description') }}</span>
|
||||||
<a class="mian-title-more" href="">更多<i class="fa fa-angle-right"></i></a>
|
<a class="mian-title-more" href="{{ getOneCategory(18,'link') }}">更多<i class="fa fa-angle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="spiritual-ul">
|
<ul class="spiritual-ul">
|
||||||
@if (getArticlesBYCate(18,4)->isNotEmpty())
|
@if (getArticlesBYCate(18,4)->isNotEmpty())
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<!-- 欢迎语 -->
|
<!-- 欢迎语 -->
|
||||||
<div class="hello">
|
<div class="hello">
|
||||||
<div class="container hello-text">
|
<div class="container hello-text">
|
||||||
今天是 {{ now()->isoFormat('Y年m月d日 a h:mm:ss') }} {{ now()->isoFormat('dddd') }}
|
今天是 {{ now()->isoFormat('Y年M月D日 a h:mm:ss') }} {{ now()->get('dayName') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end 欢迎语 -->
|
<!-- end 欢迎语 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user