PHP code example of enginedigital / model-notes

1. Go to this page and download the library: Download enginedigital/model-notes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

enginedigital / model-notes example snippets


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']
];

// User model uses EngineDigital\Note\HasNotes
$user->setNote('This is my cute little note!');
bash
php artisan vendor:publish --provider="EngineDigital\Note\NoteServiceProvider" --tag="model-notes-migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="EngineDigital\Note\NoteServiceProvider" --tag="model-notes-config"