修改详情页是否显示时间

This commit is contained in:
2020-09-22 15:56:25 +08:00
parent c120c05e9b
commit ec3323f2d2
3 changed files with 24 additions and 15 deletions

View File

@@ -28,7 +28,10 @@ class ArticleController extends Controller
$category = $article->category; $category = $article->category;
$next = Article::where('id', '>', $article->id)->where('status', 1)->first(); $next = Article::where('id', '>', $article->id)
->where('category_id', $category->id)
->where('status', 1)
->first();
$parent = getTopCate($category->id); $parent = getTopCate($category->id);
return view('articles.show', compact('article', 'category', 'next', 'parent')); return view('articles.show', compact('article', 'category', 'next', 'parent'));

View File

@@ -2,6 +2,10 @@
return [ return [
//文章详情页显示时间 的顶级分类
'show_time' => [
15, 10, 19, 31, 56, 57,
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Name | Application Name
@@ -39,7 +43,7 @@ return [
| |
*/ */
'debug' => (bool) env('APP_DEBUG', false), 'debug' => (bool)env('APP_DEBUG', false),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@@ -8,7 +8,9 @@
<div class="container details"> <div class="container details">
<!-- 文章标题 --> <!-- 文章标题 -->
<h3 class="details-title">{{ $article->title }}</h3> <h3 class="details-title">{{ $article->title }}</h3>
@if (in_array($parent->id,config('app.show_time')))
<p class="details-time">{{ $article->created_at }}</p> <p class="details-time">{{ $article->created_at }}</p>
@endif
<!-- 文章详情 --> <!-- 文章详情 -->
<div class="details-content"> <div class="details-content">
{{-- <img src="{{ $article->cover_path }}">--}} {{-- <img src="{{ $article->cover_path }}">--}}