This package provides custom fields type for the Backpack for Laravel administration panel. The _toggle
fields allows admins to toggle another fields as dependency, in a prettier way. The _array_ajax
fields adds select from array not relationships only
This package has been created to make it easy for developers to share their custom fields with the Backpack community. You can use this package to get fields type, sure. But you can also fork it, to create a Backpack addon. For more information on how to do this, check out Backpack's addon docs.
Via Composer
composer require mahmoud-mosaad/backpack-fields
Inside your custom CrudController:
$this->crud->addField([
'name' => 'from_place',
'type' => 'select_from_array_toggle',
'label' => 'From Places',
'options' => [
1 => 'First',
2 => 'Second',
3 => 'Third',
4 => 'Fourth',
100 => 'Other',
],
'allows_null' => false,
'show_when' => [
100 => [
'from_place_other'
]
],
]);
$this->crud->addField([
'name' => 'from_place_other',
'label' => trans('backpack::base.other'),
'type' => 'text',
]);
Publish Views. Copy-paste the blades to your directory:
# Publish Vendor Views to resources (Win CMD)
xcopy .\vendor\mahmoud-mosaad\backpack-fields\src\resources\views\crud\fields .\resources\views\vendor\backpack\crud\fields\
# Publish Vendor Views to resources (Bash)
cp .\vendor\mahmoud-mosaad\backpack-fields\src\resources\views\crud\fields .\resources\views\vendor\backpack\crud\fields\
Uninstall this package. Since it only provides fields you already published and you're no longer using those files, it makes no sense to have the package installed:
composer remove mahmoud-mosaad/backpack-fields
- Mahmoud Mosaad - Author
MIT. Please see the license file for more information.