Skip to content

Latest commit

 

History

History
executable file
·
61 lines (42 loc) · 1.35 KB

README.md

File metadata and controls

executable file
·
61 lines (42 loc) · 1.35 KB

Laravel Settingable

Installation

Require this package, with Composer, in the root directory of your project.

$ composer require faustbrian/laravel-settingable

Usage

Within your controllers, before you perform a redirect...

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Settingable;
}
// This will be stored in the "default" collection
$user->settings()->all();
$user->settings()->set('key', 'value');
$user->settings()->get('key');
$user->settings()->has('key');
$user->settings()->forget('key');

// This will be stored in the "visuals" collection
$user->settings()->collection('visuals')->all();
$user->settings()->collection('visuals')->set('key', 'value');
$user->settings()->collection('visuals')->get('key');
$user->settings()->collection('visuals')->has('key');
$user->settings()->collection('visuals')->forget('key');

Testing

$ phpunit

Security

If you discover a security vulnerability within this package, please send an e-mail to Brian Faust at hello@brianfaust.me. All security vulnerabilities will be promptly addressed.

Credits

License

MIT © Brian Faust