Internal note service for your Laravel application. This is not a "blog comment service".
This package requires PHP 7 and Laravel 5.6 or higher.
php composer require binary-cats\laranotePublish Migrations
php artisan vendor:publish --provider=BinaryCats\\Laranote\\LaranoteServiceProvider --tag=migrationsOptionally, publish configuration
php artisan vendor:publish --provider=BinaryCats\\Laranote\\LaranoteServiceProvider --tag=configFor any model that you want to have notes, import BinaryCats\Laranote\HasManyNotes as
use BinaryCats\Laranote\HasManyNotes;
class User extends Model
use HasManyNotes;To get all notes, use the notes() method.
To add a new note:
$user->note('This is a note content');a note will be automatically added using currently logged in user. You may pass true as a second argument, to make the note private.
To add a new note using another user:
$user = User::find(2);
$user->addNoteAsUser($user, 'This is a note content');You may pass true as a third argument, to make this note private.
In addition to notes() relation, HasManyNotes adds makeContextKey() that encrypts the model morph class and primary key. This value could be used as a owner key, if want to have a uniform note API service.
To utilize context key on the incoming side of application, Illuminate\Http\Request class is extended with three macros:
decryptContextKey()- decrypt the string into arraymakeContext()- make a model instance out of decrypted keyresolveContext()-> resolve the model instance from the DB.
resolveContext()to include trashed models, if the model supports soft-deletes- Deleting context should result in soft-deleting notes, configurable
- A bootstrap drop-in component
- A vuejs drop-in component
- Global scope of private notes
composer testRun the tests with:
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Binary Cats is a web service agency based in Roselle, Illinois.
Does your business depend on our contributions? Reach out! All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
The MIT License (MIT). Please see License File for more information.