Easily save, update and get titles, descriptions, and more. it is very easy to use.
This is great for storing and receiving general site information.
requires PHP 8+ and Laravel 9+
via composer:
$ composer require RanjbarAli/Laravel-Setting
You can publish migration and configuration with:
php artisan vendor:publish --provider="RanjbarAli\LaravelSetting\LaravelSettingServiceProvider"
Migrate:
php artisan migrate
setting()
setting()->value
setting('key')->value
setting(['key1', 'key2'])->value
setting('key')->set('new value')
setting()->add($key, $value, $type)
Type must be one of "string"
, "array"
, "boolean"
, "integer"
, "float"
default: "string"
setting('key')->delete()
setting('key')->is('value')
setting('key')->is_exactly('value')
setting('key')->exists()
setting()->restart()
setting()->add('key', ['item'], 'array');
setting('key')->value; // Output: ['item']
setting()->add('isOffline', true, 'boolean');
setting('isOffline')->value; // Output: true
setting()->add('key', 'value');
setting('key')->value; // Output: "value"
setting()->add('level', 5, 'integer');
setting('level')->value; // Output: 5
setting()->add('score', 6.5, 'float');
setting('score')->value; // Output: 6.5
setting()->add('key', 'old value');
setting('key')->set('new value');
setting('key')->value; // Output: 'new value'
setting()->add('key1', 'foo');
setting()->add('key2', 'bar');
setting(['key1', 'key2'])->value; // Output: [ 'key1' => 'foo', 'key2' => 'bar' ]
setting()->add('key', '1');
setting('key')->is(1); // Output: true
setting()->add('key', '1');
setting('key')->is_exactly(1); // Output: false
setting()->add('key', 'value');
setting('key')->delete();
setting('key')->exists(); // Output: false
in blade:
<title> {{ setting('title')->value }} </title>
<meta name="description" content=" {{ setting('description')->value }} " />
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.