digitallyhappy/toggle-field-for-backpack
Composer 安装命令:
composer require digitallyhappy/toggle-field-for-backpack
包简介
Easily toggle boolean attributes with a new field type.
README 文档
README
This package provides a toggle field type for the Backpack for Laravel administration panel. The toggle field allows admins to toggle the value of a boolean variable between true/false, in a prettier way. It uses a CSS-only solution, so it has zero external dependencies and zero javascript.
Warning This field is not compatible with the v5.1 CrudField JS Library since it is a non-JS solution. But starting with v5.2, Backpack has a built-in field, that looks just like this one, works in more situations and is easier to customize. Please consider using the official
switchfield instead of this.
Screenshots
Installation
Via Composer
composer require digitallyhappy/toggle-field-for-backpack
Usage
Inside your custom CrudController:
$this->crud->addField([ 'name' => 'agreed', 'label' => 'I agree to the terms and conditions', 'type' => 'toggle', 'view_namespace' => 'toggle-field-for-backpack::fields', ]);
Notice the view_namespace attribute - make sure that is exactly as above, to tell Backpack to load the field from this addon package, instead of assuming it's inside the Backpack\CRUD package.
Overwriting
If you need to change the field in any way, you can easily publish the file to your app, and modify that file any way you want. But please keep in mind that you will not be getting any updates.
Step 1. Copy-paste the blade file to your directory:
# create the fields directory if it's not already there mkdir -p resources/views/vendor/backpack/crud/fields # copy the blade file inside the folder we created above cp -i vendor/digitallyhappy/toggle-field-for-backpack/src/resources/views/fields/toggle.blade.php resources/views/vendor/backpack/crud/fields/toggle.blade.php
Step 2. Remove the vendor namespace wherever you've used the field:
$this->crud->addField([
'name' => 'agreed',
'type' => 'toggle',
'label' => 'I agree to the terms and conditions',
- 'view_namespace' => 'toggle-field-for-backpack::fields'
]);
Step 3. Uninstall this package. Since it only provides one file - toggle.blade.php, and you're no longer using that file, it makes no sense to have the package installed:
composer remove digitallyhappy/toggle-field-for-backpack
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email the author instead of using the issue tracker.
Credits
- Adoptavia - created the field type and shared it in this thread;
- Cristian Tabacitu - polish & packaging;
- All Contributors
License
MIT. Please see the license file for more information.
digitallyhappy/toggle-field-for-backpack 适用场景与选型建议
digitallyhappy/toggle-field-for-backpack 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 39.6k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2020 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「addon」 「laravel」 「admin panel」 「toggle」 「backpack」 「Backpack for Laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 digitallyhappy/toggle-field-for-backpack 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 digitallyhappy/toggle-field-for-backpack 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 digitallyhappy/toggle-field-for-backpack 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
Analysis module for finding problematical shop data.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Dropzone field for Laravel Backpack
This ConcreteCMS/concrete5 addon installs a block type that when added to a page allows you to redirect visitors to this page to another page that you specify or an external URL.
Alfabank REST API integration
统计信息
- 总下载量: 39.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 24
- 依赖项目数: 1
- 推荐数: 14
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-07
