kagatan / user-options
Laravel. Simple key-value storage for Users
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/kagatan/user-options
Requires
- php: >=5.5.0
- illuminate/database: >=5.0.0
- illuminate/support: >=5.0.0
README
- Simple key-value storage for Users (Laravel)
Install
composer require kagatan/user-options
Usage
use Kagatan\UserOption\UserOption; $user_id = 777; $key = 'test_key'; $value = 'test_value'; $data = [ 'test_key_a_1' => 'test_value_a_1', 'test_key_a_2' => 'test_value_a_2', 'test_key_b_1' => 'test_value_b_1', 'test_key_b_2' => 'test_value_b_2' ]; // Set key => value for User UserOption::set($user_id, $key, $value); // Get value by key for User $option = UserOption::get($user_id, $key); dump($option); // Remove by key for User UserOption::remove($user_id, $key); // Set collection [key => value] for User UserOption::set($user_id, $data); // Get all options for User $options = UserOption::getAll($user_id); dump($options); // Get options by condition for User $options = UserOption::getAll($user_id, 'test_key_a%'); dump($options);