Skip to content

Commit

Permalink
list method added
Browse files Browse the repository at this point in the history
  • Loading branch information
Raza9798 committed Aug 29, 2024
1 parent 5a16fac commit 268c703
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
49 changes: 49 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SiteConfig Laravel Package
This Laravel package provides a simple and efficient way to manage site settings. You can store, retrieve, update, and delete configuration settings on a application using the SiteConfig class.

## Installation
To install the package, add it to your Laravel project using Composer:
composer require your/package-name

# Usage
Import the package in your class
```php
use Intelrx\Sitesettings\SiteConfig;

SiteConfig::store('phone', '1234567890');
SiteConfig::get('phone');
SiteConfig::update('phone', '18487');
SiteConfig::delete('phone');
SiteConfig::list()
```

## Storing Settings
To store a new site setting, use the store method:

```php
SiteConfig::store('phone', '1234567890');
```

## Retrieving Settings
To retrieve a stored site setting, use the get method:
```php
$phone = SiteConfig::get('phone');
```

## Updating Settings
To update an existing site setting, use the update method:
```php
SiteConfig::update('phone', '18487');
```

## Deleting Settings
To delete a site setting, use the delete method:
```php
SiteConfig::delete('phone');
```

## Listing all Setting
To list complete site settings use the list method:
```php
SiteConfig::list();
```
2 changes: 1 addition & 1 deletion src/Models/SiteSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
class SiteSettings extends Model
{
use HasFactory;

protected $table = 'site_settings';
protected $fillable = ['key', 'value'];
}
5 changes: 5 additions & 0 deletions src/SiteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ public static function delete($key)
$data->delete();
}
}

public static function list()
{
return SiteSettings::all();
}
}

0 comments on commit 268c703

Please sign in to comment.