{note} You're browsing the documentation for an old version of laravel-settings. Consider upgrading your project to v2.


Rawilk\Settings\Settings is Macroable, so you can add any custom functionality you want to the class. The best place to do so would be in a service provider.

use Rawilk\Settings\Settings;

Settings::macro('getWithSuffix', function ($key, $suffix) {
    // Inside this closure you can call any method available on `Settings`.
    $value = $this->get($key);

    return $value . '_' . $suffix;

Using the macro:

use Rawilk\Settings\Facades\Settings;

Settings::set('foo', 'bar');

Settings::getWithSuffix('foo', 'some_suffix'); // 'bar_some_suffix'

// Or
settings()->getWithSuffix('foo', 'some_suffix');
← Previous Topic

Custom Eloquent Model

Next Topic →

Performance Tips

Caught a mistake? Suggest an edit on Github