webmachine/custom-fields is a Laravel package for customfields for laravel 5.
It currently has 0 GitHub stars and 447 downloads on Packagist.
Install it with composer require webmachine/custom-fields.
Discover more Laravel packages by webmachine
or browse all Laravel packages to compare alternatives.
Last updated
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"
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') !!}
The MIT License (MIT). Please see License File for more information.