2017 © Pedro Peláez
 

library laravel-settings-management

An easy way to get access to your app settings from anywhere.

image

okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  • Friday, May 18, 2018
  • by Okipa
  • Repository
  • 1 Watchers
  • 1 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 260 % Grown

The README.md

laravel-settings-management

An easy way to get access to your app settings from anywhere., (*1)

Source Code Latest Version Total Downloads License: MIT Build Status Code Coverage Scrutinizer Code Quality, (*2)

:warning: This package has been abandonned :warning:
Do not hesitate to contact me if you want to make it evolve and to maintain it., (*3)


Before starting

The settings management only uses one Model instance, which mean that using a database table to store your settings will read and update only one line.
Even if this package will work fine using database storage, using a Laravel Model Json Storage to do this can be a better option., (*4)


Installation

  • Install the package with composer :
composer require okipa/laravel-settings-management
  • Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider. If you don't use auto-discovery or if you use a Laravel 5.4- version, add the package service provider in the register() method from your app/Providers/AppServiceProvider.php :
// laravel settings management
// https://github.com/Okipa/laravel-settings-management
$this->app->register(Okipa\LaravelSettingsManagement\SettingsManagementServiceProvider::class);
  • Run the following command : php artisan vendor:publish --tag=settingsManagement.
    This will publish these files to your project (to customize according to your needs) :, (*5)

    • app/Settings.php : The Settings model.
    • config/settings.php : the settings management configuration file.
    • database/migration/2018_05_16_145709_create_settings_table.php : the settings management migration (delete this file if you chose to use the Laravel Model Json Storage).
  • Run the Laravel migration command : php artisan migrate, (*6)

  • You may want to customize the config/settings.php configuration file values :, (*7)

    • model : set the namespace of the model used for your app settings management.

Caution :
Your model-settings-management migration should have each of its field set as nullable() or having a default value.
Without this configuration, a PDOException would be thrown because an empty instance of the settings model is stored in database when none does exist., (*8)


Usage

Use the settings() helper as a model instance to access to your settings data from anywhere in your app :, (*9)

$email = settings()->email;

Update your settings data by using the settings() helper as well., (*10)

settings()->update(['email' => 'john@doe.com']);

// or

settings()->setAttribute('email', 'john@doe.com')->save();

// or

settings()->email = john@doe.com;
settings()->save();

The Versions

18/05 2018

dev-master

9999999-dev https://github.com/Okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel settings php management package okipa

18/05 2018

1.0.4

1.0.4.0 https://github.com/Okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel settings php management package okipa

18/05 2018

1.0.2

1.0.2.0 https://github.com/Okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel settings php management package okipa

16/05 2018

1.0.1

1.0.1.0 https://github.com/Okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel settings php management package okipa

16/05 2018

1.0.0

1.0.0.0 https://github.com/Okipa/laravel-settings-management

An easy way to get access to your app settings from anywhere.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel settings php management package okipa