anisaronno/laravel-settings

A Laravel package for managing application settings, similar to WordPress options.

1.2.0 2024-04-18 05:30 UTC

This package is auto-updated.

Last update: 2024-05-18 05:42:08 UTC


README

  • Laravel settings control as like as WordPress options

Table of Contents

Introduction

The Laravel Settings package simplifies the management of application settings in your Laravel project. This README provides installation instructions, usage examples, and additional information.

Installation

To get started, install the package using Composer:

composer require anisaronno/laravel-settings

Publish Migration, Factory, Config, and Seeder

You need to publish migration files, factories, configuration files, and a seeder:

php artisan vendor:publish --tag=settings-migration

Run Migration

Apply the migrations to set up the settings table:

php artisan migrate

Run Seeder

Seed the settings table with initial data:

php artisan db:seed --class=LaravelSettingsSeeder::class

Usage

The package provides methods for managing settings. Here are the available functions:

Check if a Key Exists in Database

You can use the hasSettings method to check if a key exists in the database:

hasSettings(string $key);

Get Settings Field

Retrieve a specific setting using its key:

getSettings(string $key);

Get All Settings Fields

Fetch all settings fields:

getAllSettings();

Set Settings

Create or update a setting:

setSettings(string $key, string $value);

Update Settings

Update an existing setting:

updateSettings(string $key, string $value);

Update or Create Settings

Update or Create setting:

upsertSettings(string $key, string $value);

Delete Settings

Update an existing setting:

deleteSettings(string $key);

Contribution Guide

Please follow our Contribution Guide if you'd like to contribute to this package.

License

This package is open-source software licensed under the MIT License.