diff --git a/CHANGELOG.md b/CHANGELOG.md index da028f5..9b4cf19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. \ No newline at end of file +- First version release with all featured released on document. diff --git a/readme.md b/readme.md index 52df536..c823a51 100644 --- a/readme.md +++ b/readme.md @@ -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 -``` \ No newline at end of file +``` diff --git a/src/SettingHelper.php b/src/SettingHelper.php index 6add257..77a9f6d 100644 --- a/src/SettingHelper.php +++ b/src/SettingHelper.php @@ -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 * diff --git a/src/views/generators/migration.blade.php b/src/views/generators/migration.blade.php index b65d47c..9baff43 100644 --- a/src/views/generators/migration.blade.php +++ b/src/views/generators/migration.blade.php @@ -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(); }); } @@ -31,4 +31,4 @@ public function down() { Schema::drop('settings'); } -} \ No newline at end of file +} diff --git a/tests/migrations/2016_10_18_182750_create_settings_table.php b/tests/migrations/2016_10_18_182750_create_settings_table.php index cc7fb2c..478cb67 100644 --- a/tests/migrations/2016_10_18_182750_create_settings_table.php +++ b/tests/migrations/2016_10_18_182750_create_settings_table.php @@ -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(); }); }