rinvex/laravel-pages
最新稳定版本:v7.1.3
Composer 安装命令:
composer require rinvex/laravel-pages
包简介
Rinvex Pages is an integral part for your Laravel content management system (CMS), it affords an easy, yet powerful way to create and manage pages with full control over their URLs, active status, titles, content, and other attributes.
README 文档
README
Rinvex Pages is an integral part for your Laravel content management system (CMS), it affords an easy, yet powerful way to create and manage pages with full control over their URLs, active status, titles, content, and other attributes.
Installation
-
Install the package via composer:
composer require rinvex/laravel-pages
-
Publish resources (migrations and config files):
php artisan rinvex:publish:pages
-
Execute migrations via the following command:
php artisan rinvex:migrate:pages
-
Done!
Usage
Create Your Page
To get started, you simply create a new page as follows:
$page = app('rinvex.pages.page')->create([ 'uri' => 'test', 'slug' => 'test-page', 'route' => 'frontend.pages.test', 'title' => 'Test Page', 'view' => 'test-page', ]); // Deactivate the page $page->deactivate(); // Activate the page $page->activate(); // Get all pages $pages = app('rinvex.pages.page')->all(); // Get active pages $pages = app('rinvex.pages.page')->where('is_active', true)->get();
Notes:
- All active pages are registered automatically into your application router with page's attributes, so the example page we created above could be accessed via the URL
http://your-project/test, and you can generate page's URL using the named routeroute('frontend.pages.test')as you may expect. The result of accessing that page is the content of the page's rendered view.- Rinvex Pages auto register routes for your active pages, but you can disable routes auto registration in case you need more flexibility writing your own routes and maybe linking to your custom controllers, and that could be done from the config file
config/rinvex.pages.phpif you already published it in the installation step.- Rinvex Pages expects you to create your own views before setting in page records, and that view could be anywhere and contain anything. It's important to know that all page views have access to the
$pageinstance variable by default, so you can access any of the page's attributes.
ADVANCED: Attach Resources to Page
Sometimes you need to attach other resources to a specific page, to display later as "Related Content" for example, the presentation layer is left to you to implement, but the following is how to attach these resources programmatically.
To attach other resources to any page, follow these two steps:
-
Use
\Rinvex\Pages\Traits\Pageabletrait in your resources you need to attach. -
Register your resource as a
pageable, and add mutator setter/getter support for in your resource in the page's model. This is done in service providerbootmethod. See the following example ofArticleresource we're attaching to the page:
use App\Models\Article; use Illuminate\Database\Eloquent\Relations\MorphToMany; app('rinvex.pages.pageables')->put('article', Article::class); app('rinvex.pages.page')->macro('setArticlesAttribute', function ($articles) { static::saved(function (self $model) use ($articles) { $model->entries(Article::class)->sync($articles, true); }); }); app('rinvex.pages.page')->resolveRelationUsing('articles', function ($pageModel): MorphToMany { return $pageModel->entries(Article::class); });
Changelog
Refer to the Changelog for a full history of the project.
Support
The following support channels are available at your fingertips:
Contributing & Protocols
Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.
Bug reports, feature requests, and pull requests are very welcome.
Security Vulnerabilities
If you discover a security vulnerability within this project, please send an e-mail to help@rinvex.com. All security vulnerabilities will be promptly contacted.
About Rinvex
Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
License
This software is released under The MIT License (MIT).
(c) 2016-2022 Rinvex LLC, Some rights reserved.
rinvex/laravel-pages 适用场景与选型建议
rinvex/laravel-pages 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.99k 次下载、GitHub Stars 达 38, 最近一次更新时间为 2018 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「page」 「cache」 「cms」 「ajax」 「async」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rinvex/laravel-pages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rinvex/laravel-pages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rinvex/laravel-pages 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.
repository php library
Plug-ins for DataTables
GraphQL authentication for your headless Craft CMS applications.
This package helps you use bitwise enums in PHP and Laravel.
Set Links with a specific language parameter
统计信息
- 总下载量: 3.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 38
- 点击次数: 30
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-05