webmachine/custom-fields
Composer 安装命令:
composer require webmachine/custom-fields
包简介
CustomFields for Laravel 5
README 文档
README
Install
Via Composer
$ composer require webmachine/custom-fields
Next, you must install the service provider and facade alias:
// config/app.php 'providers' => [ ... Webmachine\CustomFields\CustomFieldsServiceProvider::class, ]; ... 'aliases' => [ ... 'CustomFields' => Webmachine\CustomFields\CustomFieldsFacade::class, ];
Publish
$ php artisan vendor:publish --provider="Webmachine\CustomFields\CustomFieldsServiceProvider"
Usage
In your Controller, save your custom fields for a given table record:
... use Webmachine\CustomFields\CustomFieldsFacade as CustomFields; class FooController extends Controller { ... public function storage() { ... $foo->save(); CustomFields::save($foo->id); } }
In your Request, validate your cutom field
... use Webmachine\CustomFields\CustomFieldsFacade as CustomFields; class FooRequest extends Request { ... public function rules() { $rules = [ ... ]; $custom_rules = CustomFields::rules('table', 'form_scope'); return array_merge($rules, $custom_rules); } ... public function attributes() { $attributes = []; $custom_attributes = CustomFields::attributes('table', 'form_scope'); return array_merge($attributes, $custom_attributes); } }
In your view
{!! CustomFields::show('table', 'form_scope') !!}
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 407
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-16