小调整

This commit is contained in:
2020-09-25 13:56:57 +08:00
parent e56cdf597a
commit 737a66b0c6
5 changed files with 59 additions and 48 deletions

View File

@@ -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;
} }

View File

@@ -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;
}
} }

View File

@@ -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>

View File

@@ -253,7 +253,7 @@
<div class="mian-title"> <div class="mian-title">
<b>{{ getOneCategory(18,'title') }}</b> <b>{{ getOneCategory(18,'title') }}</b>
<span>/&nbsp;&nbsp;{{ getOneCategory(18,'description') }}</span> <span>/&nbsp;&nbsp;{{ 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())

View File

@@ -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 欢迎语 -->