ikoncept / fabriq
由 Ikoncept 提供的 CMS 框架
Requires
- php: ^8.0
- aws/aws-sdk-php: ^3.219
- doctrine/dbal: ^3.1
- dyrynda/laravel-make-user: ^7.3|^8.0|^9.0
- illuminate/database: ^8.56|^9.0|^10|^11
- illuminate/support: ^7.0.5|^8.0|^9.0|^10|^11
- infab/core: ^2.1
- infab/translatable-revisions: ^1.6.0
- kalnoy/nestedset: ^6.0
- laravel/fortify: ^1.8
- laravel/pint: ^1.2
- php-ffmpeg/php-ffmpeg: ^1.0
- pusher/pusher-php-server: ^7.0
- spatie/laravel-medialibrary: ^8.2|^9.0|^10.0|^11.0
- spatie/laravel-permission: ^6.0
- spatie/laravel-query-builder: ^3.5|^4.0|^5.0|^6.0
- spatie/laravel-sluggable: ^2.6|^3.0
- spatie/laravel-tags: ^3.1|^4.0
- spatie/laravel-webhook-server: ^3.8
- spatie/once: ^2.0|^3.0
- spatie/pdf-to-image: ^2.1
Requires (Dev)
- nunomaduro/collision: ^5.1|^6.0|^8.0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^10.0
- dev-main
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.x-dev
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.1
- 1.13.0
- 1.12.0
- 1.11.4
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.1
- dev-indexable-keys
- dev-block-model
- dev-vite
- dev-feature-ask-to-leave
- dev-feature-broadcasting-v2
- dev-image-handling
- dev-feature-broadcasting
- dev-tailwind3
- dev-php8.1
- dev-develop
This package is auto-updated.
Last update: 2024-09-05 11:10:43 UTC
README
Fabriq CMS
安装说明 💻
在您的 composer.json
文件中添加 make-user-command 的客户仓库 URL
...
"repositories": {
"0": {
"type": "vcs",
"url": "https://github.com/KarabinSE/laravel-make-user"
}
},
安装 Fabriq
composer require ikoncept/fabriq "^2.0" -W
如果您计划使用 AWS s3
# Laravel > 9 composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0" # Laravel 9+ composer require league/flysystem-aws-s3-v3 "^3.0"
安装 Mailgun 驱动程序
composer require symfony/mailgun-mailer symfony/http-client
同时安装 Laravel Sanctum 以实现身份验证
composer require laravel/sanctum
将域名添加到 .env
文件
SANCTUM_STATEFUL_DOMAINS=your-domain.test
SESSION_DOMAIN=your-domain.test
发布配置
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=config
php artisan vendor:publish --provider="Infab\TranslatableRevisions\TranslatableRevisionsServiceProvider" --tag=config
使用 .env 配置文件设置数据库
修改用户模型 🧘
用户模型需要继承 Fabriq\Models\User::class
// app/Models/User.php //... use Ikoncept\Fabriq\Models\User as FabriqUser; //... class User extends FabriqUser // ...
运行 fabriq:install
命令
php artisan fabriq:install
此命令将发布前端资源和视图。它还将运行迁移
重要 删除 resources/js
目录中的 app.js
和 bootstrap.js
文件
rm resources/js/app.js && rm resources/js/bootstrap.js
运行 pnpm install
和 pnpm production
来构建资源
pnpm install && pnpm production
身份验证配置 🗝
Laravel v11 及以上版本
注意
在 Laravel 11 及以上版本中,以下步骤不是必需的,因为安装时文件将被覆盖
Laravel 11 以下版本
在 app\Http\Kernel.php
中启用 Laravel Sanctum 中间件
// app\Http\Kernel.php /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, // <--- 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ];
注册路由 🛣
注意
在 Laravel 11 及以上版本中,此步骤不是必需的,因为安装时文件将被覆盖
注册适合您应用程序的路由。以下是一些示例
// routes/api.php use Ikoncept\Fabriq\Fabriq; Fabriq::routes(function ($router) { $router->forDevProtected(); }, [ 'middleware' => ['auth:sanctum', 'role:dev', 'verified'], 'prefix' => 'dev' ]); Fabriq::routes(function ($router) { $router->forApiAdminProtected(); }, [ 'middleware' => ['auth:sanctum', 'role:admin', 'verified'], 'prefix' => 'admin' ]); Fabriq::routes(function ($router) { $router->forApiProtected(); }, [ 'middleware' => ['auth:sanctum'] ]); Fabriq::routes(function ($router) { $router->forPublicApi(); });
// routes/web.php use Ikoncept\Fabriq\Fabriq; Fabriq::routes( function ($router) { $router->allWeb(); } );
在数据库中创建第一个用户,或者通过像 michaeldyrynda/laravel-make-user 这样的包来创建
发布资源 🗄️
可以使用各自的标签来发布资源。可用的标签有
config
- 配置文件fabriq-translations
- 身份验证视图和验证消息的翻译fabriq-frontend-assets
- 前端构建系统和 Vue 项目文件fabriq-views
- Blade 视图和布局
您可以使用以下命令发布这些资源
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=the-tag
如果您想用新资源覆盖旧资源(例如,当包更新了视图时),可以使用 --force
标志
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=fabriq-views --force
注意 上述标签在运行 fabriq:install
时已发布
广播 📢
Fabriq 利用 laravel/echo 作为前端依赖项与推送服务器通信。此包预先配置为使用 Ikoncept 的自己的 WebSocket 服务器,但可以替换为推送实现。
要启用半自动存在广播,请转到 /resources/js/plugins/index.js
并取消注释 Laravel Echo 的行
// import '~/plugins/laravel-echo' import '~/plugins/toast' import '~/plugins/v-calendar' import '~/plugins/v-mask' // ...
如果未导入 Laravel Echo 插件,则不会启用它。
不要忘记添加适当的 .env
变量
BROADCAST_DRIVER=ikoncept_pusher
PUSHER_APP_ID=400
PUSHER_APP_KEY=your-key
PUSHER_APP_SECRET=your-secret
PUSHER_APP_CLUSTER=mt1
如果您想为特定页面创建存在频道,只需将其添加到路由中
{ path: '/articles/:id/edit', name: 'articles.edit', component: ArticlesEdit, meta: { middleware: [RolesMiddleware, PresenceMiddleware], // <- Added here (PresenceMiddleware) roles: ['admin'], } },
如果您想为特定页面创建广播频道,只需将其添加到路由中
{ path: '/articles/:id/edit', name: 'articles.edit', component: ArticlesEdit, meta: { middleware: [RolesMiddleware, BroadcastMiddleware], // <- Added here (PresenceMiddleware) roles: ['admin'], broadcastName: 'article' } },
当应用广播中间件时,它将监听 updated
、created
和 deleted
事件。这对于需要实时更新的索引视图非常有用。
更新 ♻️
您可以使用 php artisan fabriq:update
命令发布新的前端资源。此命令将发布新的前端资源并运行迁移。
完成? 🎉
这就对了,提供应用程序并在 /login
登录
许可协议
麻省理工学院许可证(MIT)。请参阅许可证文件获取更多信息。
测试
composer test