thyseus / laravel-database-redirector
此包提供了一个数据库重定向器和简单的管理后端,用于:https://github.com/spatie/laravel-missing-page-redirector
0.1.0
2020-05-04 15:39 UTC
Requires
This package is auto-updated.
Last update: 2024-09-04 23:05:05 UTC
README
此包为:https://github.com/spatie/laravel-missing-page-redirector 提供了一个数据库重定向器和(非常)简单的管理后端。
截图
先决条件
为此包,您需要
- 一个 laravel 6.x 或更高版本的应用程序
- 一个已配置的数据库
- 一个名为
admin
的中间件,用于控制管理访问
安装
- 运行:
composer require thyseus/laravel-database-redirector
- 运行:
php artisan vendor:publish --provider="Spatie\MissingPageRedirector\MissingPageRedirectorServiceProvider"
- 运行:
php artisan vendor:publish --tag=public --force
运行:
php artisan migrate
编辑您的
config/missing-page-redirector.php
并将'redirector'
设置为\Thyseus\DBRedirector\Redirectors\DBRedirector::class
- 访问
http://localhost/admin/redirects
以管理您应用程序的重定向。
提示
默认情况下,只有 404 错误会被重定向。如果您想让 laravel-missing-page-redirector 重定向配置的每个路由,您需要将 'redirect_status_codes'
配置设置为空数组。
感谢 MVP CSS 框架(https://github.com/andybrewer/mvp/),该框架与该包捆绑在一起,使得后端至少看起来有点吸引力 :)
测试
为了对此包进行自动化测试,您需要在应用程序中使用 codeception(https://codeception.com/)测试框架。您可以将提供的功能测试复制到 tests/Functional/RedirectsCest.php 中,或者将其用作模板来执行自己的测试。