Skip to content

Commit

Permalink
Added support null value allow and add new method set similar to put.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmerainfo committed Apr 8, 2017
1 parent d48f244 commit 00bf02b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log
All notable changes to this project will be documented in this file.

## 1.0.1 - 2017-04-08
- Added support null value allow and add new method set similar to put.

## 1.0.0 - 2016-10-09
- First version release with all featured released on document.
- First version release with all featured released on document.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Here's a quick example that shows how to use `Setting`:

```php
Setting::put('key', 'value'); // Insert settings into database
Setting::set('key', 'value'); // Insert settings into database
Setting::get('key'); // Get settings from database
Setting::has('key'); // Check key exits in database
Setting::forget('key'); // Delete key and value from database
```
```
13 changes: 13 additions & 0 deletions src/SettingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ public function put($key, $value)
]);
}

/**
* Store new key and value in settings if it's already
* exits then override.
*
* @param string $key
* @param string $value
* @return null
*/
public function set($key, $value)
{
return $this->put($key, $value);
}

/**
* Delete setting data from databasse
*
Expand Down
4 changes: 2 additions & 2 deletions src/views/generators/migration.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up()
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
$table->string('key')->unique()->index();
$table->text('value');
$table->text('value')->nullable();
$table->timestamps();
});
}
Expand All @@ -31,4 +31,4 @@ public function down()
{
Schema::drop('settings');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function up()
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
$table->string('key')->unique()->index();
$table->text('value');
$table->text('value')->nullable();
$table->timestamps();
});
}
Expand Down

0 comments on commit 00bf02b

Please sign in to comment.