enginedigital/model-notes

Create notes on eloquent models. Supports multiple note types as well as multi-tenancy
1,620
Install
composer require enginedigital/model-notes
Latest Version:1.7.0
PHP:^8.0
Laravel:8
License:MIT
Last Updated:May 12, 2022
Links: GitHub  ·  Packagist
Maintainer: james2doyle

Create notes on eloquent models. Supports multiple note types as well as multi-tenancy

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Create notes on eloquent models. Supports multiple note types as well as multi-tenancy.

Installation

You can install the package via composer:

composer require enginedigital/model-notes

You can publish and run the migrations with:

php artisan vendor:publish --provider="EngineDigital\Note\NoteServiceProvider" --tag="model-notes-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="EngineDigital\Note\NoteServiceProvider" --tag="model-notes-config"

This is the contents of the published config file:

return [
    'note_model' => EngineDigital\Note\Note::class,
    'note_default_type' => 'none',
    'note_default_group' => 'admin',
    // key => 'formatter_class_with_invoke',
    // key => ['formatter', 'method'],
    'note_types' => [
        'none' => null, // dont touch formatted output
        'plain' => 'e', // escape in formatted output
        'html' => null, // dont touch formatted output
        'markdown' => [\Illuminate\Support\Str::class, 'markdown'],
        'json' => 'json_decode', // treat the note content as JSON
    ],
    'model_primary_key_attribute' => 'model_id',
    'encrypt_notes' => false,
    'tenant_model' => null, // App\Models\Company::class
    'tenant_resolver' => null, // a class that uses `__invoke` or a container function to get the id of the current tenant
    'author_model' => null, // App\Models\User::class
    'author_resolver' => null, // a class that uses `__invoke` or a container function to get the id of the current user
    'cache_time' => null, // cache time in seconds
    'load_with' => [], // which note relationships to eager load. Example: ['author', 'author.profile', 'author.roles'] or only specific columns ['author:id,name']
];

Usage

// User model uses EngineDigital\Note\HasNotes
$user->setNote('This is my cute little note!');

Testing

composer run test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

bachisoft/thunder-pack

Laravel multi-tenant SaaS package with subscription management, flexible limits...

1,499 0
guissilveira/laravel-pgsql-multi-tenant-migrate

Laravel Artisan command to migrate postgres multi tentant

188 1
hipsterjazzbo/landlord

A simple, single database multi-tenancy solution for Laravel 5.2+

273,058 607
sagalbot/encryptable

Allows you to store Eloquent properties encrypted in your database, and automati...

60,915 27
thomaswelton/laravel-mcrypt-faker

Allows installation of Laravel where the PHP Mcrypt extension is not available....

4,341 10

Version History

Version Released PHP Laravel License
1.7.0 ^8.0 ^8.37 MIT
1.6.0 ^8.0 ^8.37 MIT
1.5.0 ^8.0 ^8.37 MIT
1.4.0 ^8.0 ^8.37 MIT
1.3.0 ^8.0 ^8.37 MIT