PHP Classes

Laravel Settings Model: Store and retrieve settings for model objects

Recommend this page to a friend!
  Info   View files Documentation   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 39 All time: 10,878 This week: 455Up
Version License PHP version Categories
laravel-settings 1.0Custom (specified...5PHP 5, Databases, Libraries, Design P...


This package can store and retrieve settings for Laravel model objects.

It provides a trait that can be used by Laravel model class, so the values of settings for those model class objects are retrieved from settings model objects.

The package also provides means to create, read, update and delete settings objects.

Innovation Award
PHP Programming Innovation award nominee
March 2020
Number 6
Many applications need to deal with objects that represent important entities that the applications use, like for instance, an e-commerce product that is sold on a site. These objects are usually stored using model classes.

Sometimes it is necessary to customize the behavior of model objects according to application settings that may even be customized for each application user.

The package makes it easier to implement model classes that can be customized with settings model objects.

Manuel Lemos
Picture of Moamen Eltouny
  Performance   Level  
Name: Moamen Eltouny <contact>
Classes: 37 packages by
Country: Egypt Egypt
Age: 31
All time rank: 258426 in Egypt Egypt
Week rank: 20 Up1 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 21x


[RaggiTech] Laravel >= 6.0 - Settings/Info.

Latest Stable Version Total Downloads License

Laravel Settings/Info provides a quick and easy methods (General/Model).


// Create/Update Setting
$page->setSetting('facebook_url', '');

// Retrieve Setting's Value
echo $page->setting('facebbok_url');	//


Install the latest version using Composer:

$ composer require raggitech/laravel-settings

then publish the migration & migrate

$ php artisan vendor:publish --tag=laravel-settings
$ php artisan migrate


// An Example : (Page Model)
// Using HasSettings in Page Model
use RaggiTech\Laravel\Settings\HasSettings;

class Page extends Model
    use hasSettings;

<a name="gs"></a>

General Settings

<a name="gs_cu"></a>

Create / Update Setting's Value

use RaggiTech\Laravel\Settings\Settings;

// Single
Settings::set('website_status', true);

// Multi
	'website_status' => false,
	'website_off_message' => 'OFFLINE!',

<a name="gs_get"></a>

Retrieve Value & All

use RaggiTech\Laravel\Settings\Settings;

// Single
$setting = Settings::get('website_keywords'); // raggitech, raggi, ...

// All
$settings = Settings::get(); // => All General Setting

<a name="gs_dc"></a>

Delete & Clear

use RaggiTech\Laravel\Settings\Settings;

// Delete/Remove

// Clear
Settings::clear(); // Clearing the general settings

<a name="m"></a>

Model Settings

<a name="m_cu"></a>

Create / Update Setting's Value

// Single
$page->setSetting('status', true);

// Multi
	'website_url'    => '',
	'facebook_url'   => '',
	'twitter_url'    => '',
	'instagram_url'  => '',

<a name="m_get"></a>

Retrieve Value & All

// Single
$setting = $page->setting('website_url');

// All
$settings = $page->settings;

<a name="gs_dc"></a>

Delete & Clear

// Delete/Remove

// Clear
$page->clearSettings();// Clearing page's settings

<a name="scopes"></a>


// Get every element has no Settings.
$p1 = Page::withoutSettings()->get();

// Get every element has setting (status).
$p2 = Page::withSettings('status')->get();

// Get every element has setting (status == true).
$p3 = Page::withSettingsValue('status', true)->get();

// Get every element has [facebook or twitter or all] settings.
$p4 = Page::withAnySettings(['facebook', 'twitter'])->get();


MIT license

  Files folder image Files  
File Role Description
Files folder imagesrc (3 files, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagedatabase (1 directory)
Files folder imageTraits (2 files)
  Plain text file CurrencyServiceProvider.php Class Class source
  Plain text file hasSettings.php Class Class source
  Plain text file Settings.php Class Class source

  Files folder image Files  /  src  /  database  
File Role Description
Files folder imagemigrations (1 file)

  Files folder image Files  /  src  /  database  /  migrations  
File Role Description
  Plain text file settings.stub Class Class source

  Files folder image Files  /  src  /  Traits  
File Role Description
  Plain text file Relationships.php Class Class source
  Plain text file Scopes.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,878
This week:455Up