PHPackages                             eleven59/backpack-settings-extended - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. eleven59/backpack-settings-extended

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

eleven59/backpack-settings-extended
===================================

Extends Backpack settings package to allow for categorization of settings, file/image uploads, custom entity names, and custom sort order

3.0.3(2w ago)2134MITPHP

Since Jun 10Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/eleven59/backpack-settings-extended)[ Packagist](https://packagist.org/packages/eleven59/backpack-settings-extended)[ Docs](https://github.com/eleven59/backpack-settings-extended)[ RSS](/packages/eleven59-backpack-settings-extended/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (22)Used By (0)

Backpack Settings Extended
==========================

[](#backpack-settings-extended)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1547c5e528fb6c93cd1d5627871d3a34b5ae069c474177c5ac8eb52f38ffa738/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6576656e35392f6261636b7061636b2d73657474696e67732d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eleven59/backpack-settings-extended)[![Total Downloads](https://camo.githubusercontent.com/a69db9921bbfd235547616c91f62e24ff50bd38ea4b04a373546941eb47488e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6576656e35392f6261636b7061636b2d73657474696e67732d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eleven59/backpack-settings-extended)

**Extension for `backpack/settings`**

This package extends the **Backpack for Laravel** `backpack/settings` package:

- easily create multiple backend pages for settings so you can categorize them for your users
- custom sort order for settings list pages
- customize entity names (instead of "setting"/"settings")
- default options for field types (e.g. custom ckeditor build)
- add widgets to list or update operations
- translatable settings

Installation
------------

[](#installation)

### Dependencies

[](#dependencies)

This package requires

- [backpack/crud:^6.0|^7.0](https://github.com/Laravel-Backpack/CRUD)
- [backpack/settings:^3.1](https://github.com/Laravel-Backpack/Settings)
- [spatie/laravel-translatable:^6.0](https://github.com/spatie/laravel-translatable)

### Installation

[](#installation-1)

Via Composer

```
# Install module + dependencies
composer require eleven59/backpack-settings-extended

# Publish Backpack Settings migration, then run all migrations
php artisan vendor:publish --provider="Backpack\Settings\SettingsServiceProvider" --tag=migrations
php artisan migrate

# Publish Backpack Extended config file
php artisan vendor:publish --provider="Eleven59\BackpackSettingsExtended\AddonServiceProvider"
```

You will now find the config file at `config/eleven59/backpack-settings-extended.php`

Usage
-----

[](#usage)

### Multiple settings pages

[](#multiple-settings-pages)

This packages adds a `type` column to the settings table. Using this column, you can create multiple backend settings pages to categorize settings. You can configure the routes in the `config` file as follows:

```
'routes' => [
    'url-slug' => 'type-column-value',
]
```

If you've added an entry to the database that has "type-column-value" in the `type` column, that settings entry will now automatically show up on the following pages if you have the above array in your config file:

```
# All settings (default URL slug can be changed in config):
https://your-site/{backpack-admin-slug}/setting

# Only settings with "type-column-value" as their DB type
https://your-site/{backpack-admin-slug}/url-slug
```

### Default options for field types

[](#default-options-for-field-types)

You can use the `config/eleven59/backpack-settings-extended.php` file to add custom default definitions for field types, so you don't have to enter complex stuff in the database, that sometimes does not even work (e.g. for ckeditor fields like in the example below).

**Note:** the defaults are overwritten if the main key (i.e., 'crop' or 'withFiles' below) exists in the field definition in the database. The defaults are only used if the entire key is missing from the field definition in the database.

```
'field-defaults' => [
    'image' => [
        'crop' => true,
        'withFiles' => [
            'disk' => 'public',
            'path' => 'settings',
        ],
    ],
    'ckeditor' => [
        'custom_build' => [
            resource_path('assets/ckeditor/ckeditor.js'),
            resource_path('assets/ckeditor/ckeditor-init.js'),
        ],
    ],
],
```

### Widgets

[](#widgets)

You can define widgets for both the list and update operations (since these are the only two available anyway). This will allow you to load custom scripts and css for example, which may help with some of the more convoluted custom default column defaults.

```
'widgets' => [
    'list' => [],
    'update' => [
        [
            'type' => 'script',
            'content' => 'https://unpkg.com/jquery-colorbox@1.6.4/jquery.colorbox-min.js',
        ],
        [
            'type' => 'style',
            'content' => 'https://unpkg.com/jquery-colorbox@1.6.4/example2/colorbox.css',
        ],
    ],
],
```

### Custom sort order

[](#custom-sort-order)

This package adds a `position` column to the settings table. By default, the list pages are ordered by this column in ascending order. You can change this behavior in the `config/eleven59/backpack-settings-extended.php` file:

```
'order-by' => [
    'field' => 'position',
    'order' => 'asc',
],
```

### Custom entity string names

[](#custom-entity-string-names)

This package allows you to change the default entity names of "setting" for singular and "settings" for plural. By default, the backpack/settings strings are used. You can change their values in the `config/eleven59/backpack-settings-extended.php` file:

```
'entity-name-strings' => [
    'singular' => 'setting',
    'plural' => 'settings',
],
```

### Translatable

[](#translatable)

If you want to use translatable settings, you can do so by enabling the custom Settings model included for that:

```
//'model' => \Eleven59\BackpackSettingsExtended\Models\Setting::class, //  \Eleven59\BackpackSettingsExtended\Models\SettingWithTranslations::class, //
