mishajib/laravel-settings

This package manage your site basic settings like - site title, logo etc. You can also add your custom setting using this package.

v1.0.0 2021-05-04 17:12 UTC

This package is auto-updated.

Last update: 2021-05-04 17:20:54 UTC


README

Latest Stable Version License Total Downloads

We use settings in every application. Which we have to do again and again in every application. For this I have created a package through which you can create settings very quickly. You can also make the settings by running the command if you want.

Installation

You can install the package via composer:

composer require mishajib/laravel-settings

Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel without auto-discovery:

If you don't use auto-discovery, add the ServiceProvider to the $providers array in config file config/app.php

MISHAJIB\Settings\SettingServiceProvider::class,

If you want to use the facade to log messages, add this to your facades in app.php:

'LaravelSetting' => MISHAJIB\Settings\Facades\LaravelSettings::class,

You can also publish vendor and run the migrations with:

php artisan vendor:publish --provider="MISHAJIB\Settings\SettingServiceProvider"
php artisan migrate

This is the contents of the published config file:

Usage

use MISHAJIB\Settings\Facades\LaravelSettings;

LaravelSettings::set('setting_key', 'setting_value'); // create or update
LaravelSettings::get('setting_key'); // get the setting
LaravelSettings::forget('setting_key'); // remove the setting
LaravelSettings::all(); // get all settings

Commands

php artisan misetting:create
php artisan misetting:update
php artisan misetting:forget
php artisan misetting:all

Create Command

This command will create setting and save into settings table. This command take two arguments - setting name and setting value. Setting name should be string, can't use space or '-'. Also setting value should be string. Setting key example - site_title, logo etc. Just write command and hit enter then it will ask for arguments. After giving arguments setting will be created.

php artisan misetting:create

Update Command

This command will update setting and save into settings table. This command take two arguments - setting name and setting value. Setting name should be string, can't use space or '-'. Also setting value should be string. Setting key example - site_title, logo etc. Just write command and hit enter then it will ask for arguments. After giving arguments setting will be updated.

php artisan misetting:update

Forget Command

This command will delete setting from settings table. This command take one argument - setting name/key. Just write command and hit enter then it will ask for argument. After give the argument setting will be deleted.

php artisan misetting:forget

Show Command

This command will show all setting from settings table. Just write command and hit enter and get all settings.

php artisan misetting:all

License

The MIT License (MIT). Please see License File for more information.