小调整
This commit is contained in:
@@ -20,7 +20,7 @@ class CategoryController extends Controller
|
||||
} else {
|
||||
$articles = $category->relations(Category::TYPE_ARTICLE)->paginate(8);
|
||||
$parent = $category;
|
||||
if ($category->childrens->isEmpty() && $category->patent) {
|
||||
if ($category->childrens->isEmpty() && $category->parent) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,4 +74,15 @@ class Category extends Model
|
||||
return $ids;
|
||||
}
|
||||
|
||||
public function getTop()
|
||||
{
|
||||
$parent = $this;
|
||||
|
||||
while ($parent->parent_id) {
|
||||
$parent->parent;
|
||||
}
|
||||
|
||||
return $parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', '搜索结果')
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- mian -->
|
||||
<div class="container child">
|
||||
<!-- content -->
|
||||
<div class="child-content sslb">
|
||||
<ul class="spiritual-ul jlhz-border">
|
||||
@if ($articles->isNotEmpty())
|
||||
@foreach ($articles as $article)
|
||||
<li>
|
||||
<a class="nowrap" href="{{ $article->link }}">
|
||||
<i class="fa fa-angle-double-right"></i>
|
||||
{{ $article->title }}
|
||||
<span>{{ $article->created_at->format('Y-m-d') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="spiritual-ul-li">
|
||||
<a href="{{ $article->link }}">
|
||||
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
||||
<p class="spiritual-info nowrap-multi">
|
||||
{{ $article->descriiption }}
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
</ul>
|
||||
<!-- 分页 -->
|
||||
<div class="pages">
|
||||
@if ($articles->isNotEmpty())
|
||||
{{ $articles->appends(['title'=>request()->title])->links('layouts.pagination') }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end mian -->
|
||||
|
||||
@endsection
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', '搜索结果')
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- mian -->
|
||||
<div class="container child">
|
||||
<!-- content -->
|
||||
<div class="child-content sslb">
|
||||
<ul class="spiritual-ul jlhz-border">
|
||||
@if ($articles->isNotEmpty())
|
||||
@foreach ($articles as $article)
|
||||
<li>
|
||||
<a class="nowrap" href="{{ $article->link }}">
|
||||
<i class="fa fa-angle-double-right"></i>
|
||||
{{ $article->title }}
|
||||
<span>{{ $article->created_at->format('Y-m-d') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="spiritual-ul-li">
|
||||
<a href="{{ $article->link }}">
|
||||
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
||||
<p class="spiritual-info nowrap-multi">
|
||||
{{ $article->descriiption }}
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
</ul>
|
||||
<!-- 分页 -->
|
||||
<div class="pages">
|
||||
@if ($articles->isNotEmpty())
|
||||
{{ $articles->appends(request()->all())->links('layouts.pagination') }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end mian -->
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<div class="mian-title">
|
||||
<b>{{ getOneCategory(18,'title') }}</b>
|
||||
<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>
|
||||
<ul class="spiritual-ul">
|
||||
@if (getArticlesBYCate(18,4)->isNotEmpty())
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<!-- 欢迎语 -->
|
||||
<div class="hello">
|
||||
<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>
|
||||
<!-- end 欢迎语 -->
|
||||
|
||||
Reference in New Issue
Block a user