diff --git a/app/Http/Controllers/Front/FrontPostController.php b/app/Http/Controllers/Front/FrontPostController.php index bff9b70..6296881 100644 --- a/app/Http/Controllers/Front/FrontPostController.php +++ b/app/Http/Controllers/Front/FrontPostController.php @@ -14,7 +14,19 @@ class FrontPostController extends Controller { - public function index(Request $request, $slug) + public function redirect(Request $request, $slug) + { + $post = Post::where('slug', $slug)->where('status', 'publish')->first(); + + if (is_null($post)) { + return abort(404); + } + + return redirect()->route('front.post',['category_slug' => $post->category->slug, 'slug' => $post->slug]); + + } + + public function index(Request $request, $category_slug, $slug) { $post = Post::where('slug', $slug)->where('status', 'publish')->first(); diff --git a/composer.json b/composer.json index 178b577..c96a048 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "watson/active": "^7.0" }, "require-dev": { + "barryvdh/laravel-debugbar": "^3.9", "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", "laravel/sail": "^1.18", diff --git a/composer.lock b/composer.lock index e39df8f..0df159d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "188bab118ada68d970c9a2927e68c673", + "content-hash": "4bb8fad2567f5c7b3e6a1682fe4eaf39", "packages": [ { "name": "artesaos/seotools", @@ -8934,6 +8934,90 @@ } ], "packages-dev": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v3.9.2", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/bfd0131c146973cab164e50f5cdd8a67cc60cab1", + "reference": "bfd0131c146973cab164e50f5cdd8a67cc60cab1", + "shasum": "" + }, + "require": { + "illuminate/routing": "^9|^10", + "illuminate/session": "^9|^10", + "illuminate/support": "^9|^10", + "maximebf/debugbar": "^1.18.2", + "php": "^8.0", + "symfony/finder": "^6" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^5|^6|^7|^8", + "phpunit/phpunit": "^8.5.30|^9.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.8-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\Debugbar\\ServiceProvider" + ], + "aliases": { + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.9.2" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2023-08-25T18:43:57+00:00" + }, { "name": "brianium/paratest", "version": "v7.2.7", @@ -9814,6 +9898,72 @@ }, "time": "2023-09-11T17:37:09+00:00" }, + { + "name": "maximebf/debugbar", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "30f65f18f7ac086255a77a079f8e0dcdd35e828e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30f65f18f7ac086255a77a079f8e0dcdd35e828e", + "reference": "30f65f18f7ac086255a77a079f8e0dcdd35e828e", + "shasum": "" + }, + "require": { + "php": "^7.1|^8", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4|^5|^6" + }, + "require-dev": { + "phpunit/phpunit": ">=7.5.20 <10.0", + "twig/twig": "^1.38|^2.7|^3.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.19.0" + }, + "time": "2023-09-19T19:53:10+00:00" + }, { "name": "mockery/mockery", "version": "1.6.6", diff --git a/resources/views/front/partials/post_detail.blade.php b/resources/views/front/partials/post_detail.blade.php index b2719cb..ea2eb4b 100644 --- a/resources/views/front/partials/post_detail.blade.php +++ b/resources/views/front/partials/post_detail.blade.php @@ -1,6 +1,10 @@