From ec3323f2d2e027299513bd514b90c07e29fb3190 Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Tue, 22 Sep 2020 15:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/ArticleController.php | 5 +++- config/app.php | 28 ++++++++++++---------- resources/views/articles/show.blade.php | 6 +++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index f8fe92e..775b37c 100644 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -28,7 +28,10 @@ class ArticleController extends Controller $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); return view('articles.show', compact('article', 'category', 'next', 'parent')); diff --git a/config/app.php b/config/app.php index 3fe2039..0400ddf 100644 --- a/config/app.php +++ b/config/app.php @@ -2,6 +2,10 @@ return [ + //文章详情页显示时间 的顶级分类 + 'show_time' => [ + 15, 10, 19, 31, 56, 57, + ], /* |-------------------------------------------------------------------------- | Application Name @@ -13,7 +17,7 @@ return [ | */ - 'name' => env('APP_NAME', 'Laravel'), + 'name' => env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- @@ -26,7 +30,7 @@ return [ | */ - 'env' => env('APP_ENV', 'production'), + 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- @@ -39,7 +43,7 @@ return [ | */ - 'debug' => (bool) env('APP_DEBUG', false), + 'debug' => (bool)env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- @@ -52,9 +56,9 @@ return [ | */ - 'url' => env('APP_URL', 'http://localhost'), + 'url' => env('APP_URL', 'http://localhost'), - 'asset_url' => env('ASSET_URL', null), + 'asset_url' => env('ASSET_URL', null), /* |-------------------------------------------------------------------------- @@ -67,7 +71,7 @@ return [ | */ - 'timezone' => 'PRC', + 'timezone' => 'PRC', /* |-------------------------------------------------------------------------- @@ -80,7 +84,7 @@ return [ | */ - 'locale' => 'zh-CN', + 'locale' => 'zh-CN', /* |-------------------------------------------------------------------------- @@ -106,7 +110,7 @@ return [ | */ - 'faker_locale' => 'en_US', + 'faker_locale' => 'en_US', /* |-------------------------------------------------------------------------- @@ -119,9 +123,9 @@ return [ | */ - 'key' => env('APP_KEY'), + 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', + 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- @@ -134,7 +138,7 @@ return [ | */ - 'providers' => [ + 'providers' => [ /* * Laravel Framework Service Providers... @@ -188,7 +192,7 @@ return [ | */ - 'aliases' => [ + 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Arr' => Illuminate\Support\Arr::class, diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php index 33bf789..f7cf146 100644 --- a/resources/views/articles/show.blade.php +++ b/resources/views/articles/show.blade.php @@ -8,8 +8,10 @@

{{ $article->title }}

-

{{ $article->created_at }}

- + @if (in_array($parent->id,config('app.show_time'))) +

{{ $article->created_at }}

+ @endif +
{{-- --}}