Skip to content

Adds custom fields which useful for certain purposes to Backpack Laravel.

License

Notifications You must be signed in to change notification settings

mahmoud-mosaad/backpack-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Fields for Backpack 4.*

Latest Version on Packagist Total Downloads

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.

Screenshots

Select From Array Toggle

Installation

Via Composer

composer require mahmoud-mosaad/backpack-fields

Usage

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

Credits

License

MIT. Please see the license file for more information.

About

Adds custom fields which useful for certain purposes to Backpack Laravel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages