mostbyte/multidomain

Mostbyte 域管理器

5.0.0 2024-05-27 07:52 UTC

README

Laravel Laravel Laravel License

多域名用于Laravel

用于在多子域名环境下使用Laravel的扩展

文档

版本兼容性

安装

要获取 Mostbyte Multidomain 的最新版本,只需使用 Composer 需求项目

composer require mostbyte/multidomain

当然,您也可以手动更新需求块并运行 composer update,如果这样选择的话

{
  "require": {
    "mostbyte/multidomain": "^5.0"
  }
}

发布配置文件

php artisan vendor:publish --provider="Mostbyte\Multidomain\MultidomainServiceProvider"

使用方法

有一个助手 mostbyteDomainManager,它返回 DomainManager,您可以使用其中创建的所有方法,例如

$subDomain = mostbyteDomainManager()->getSubDomain();

控制台命令文档

  1. 首先,您需要使用以下命令创建新模式
php artisan mostbyte:schema {schema}
  1. 然后,您可以使用以下命令运行迁移,并使用默认Laravel migrate 命令中的所有标志
php mostbyte:migrate {schema}
                {--force : Force the operation to run when in production}
                {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths}
                {--pretend : Dump the SQL queries that would be run}
                {--seed : Indicates if the seed task should be re-run}
                {--step : Force the migrations to be run so they can be rolled back individually}
                {--all : Run migrations for all schemas}
  1. 或者还有刷新数据库的命令
php mostbyte:fresh {schema}
        {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths}
        {--seed : Indicates if the seed task should be re-run}
        {--step : Force the migrations to be run so they can be rolled back individually}
  1. 如果您想 删除 模式 以及其中所有数据,运行此命令
php artisan mostbyte:rollback {schema}