[更新] 文章详情左侧加分类

This commit is contained in:
2021-01-13 13:41:06 +08:00
parent f8da74af19
commit 42982a8b36
2 changed files with 46 additions and 21 deletions

View File

@@ -11,8 +11,8 @@ class ArticleController extends Controller
/** /**
* 显示分类 * 显示分类
* @param Category $category [description] * @param \App\Models\Article $article
* @return [type] [description] * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View [type] [description]
*/ */
public function show(Article $article) public function show(Article $article)
{ {
@@ -24,7 +24,7 @@ class ArticleController extends Controller
->where('status', 1) ->where('status', 1)
->first(); ->first();
return view('article.show', compact('article', 'next', 'parent')); return view('article.show', compact('article', 'next', 'parent', 'category'));
} }

View File

@@ -3,26 +3,51 @@
@section('title', '文章详情') @section('title', '文章详情')
@section('content') @section('content')
<!-- mian -->
<div class="container child"> <div class="container child">
<div class="wzxq"> <!-- 侧边导航 -->
<h3>{{ $article->title }}</h3> <div class="child-nav">
<p>发表时间:{{ $article->created_at }}</p> <div class="kj-bjt" style="text-align: center;">
</div> <b>{{ $category->title }}</b>
<div class="ritText"> <p>{{ $category->description }}</p>
{{-- @if ($article->cover)--}}
{{-- <img src="{{ $article->cover_path }}">--}}
{{-- @endif--}}
<p>
{!! $article->content !!}
</p>
</div>
@if ($next)
<div class="xyp">
<b>下一篇</b><a href="{{ $next->link }}">{{ $next->title }}</a>
</div> </div>
@endif <ul class="child-nav-ul">
@if ($parent->childrens->isNotEmpty())
@foreach ($parent->childrens as $child)
<li>
<a href="{{ $child->link }}" @if($category->id==$child->id) class="show" @endif>{{ $child->title }}</a>
</li>
@endforeach
@endif
</ul>
</div>
<!-- content -->
<div class="child-content">
<!-- mian -->
<div class="container child">
<div class="wzxq">
<h3>{{ $article->title }}</h3>
<p>发表时间:{{ $article->created_at }}</p>
</div>
<div class="ritText">
{{-- @if ($article->cover)--}}
{{-- <img src="{{ $article->cover_path }}">--}}
{{-- @endif--}}
<p>
{!! $article->content !!}
</p>
</div>
@if ($next)
<div class="xyp">
<b>下一篇</b><a href="{{ $next->link }}">{{ $next->title }}</a>
</div>
@endif
</div>
<!-- end mian -->
</div>
</div> </div>
<!-- end mian -->
@endsection @endsection