PHP code example of digitalcloud / laravel-model-notes

1. Go to this page and download the library: Download digitalcloud/laravel-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/ */

    

digitalcloud / laravel-model-notes example snippets


// add a note
$model->setNote('New Note Here');

// get all notes
$model->notes();

return [

    /*
     * The class name of the note model that holds all notes.
     * 
     * The model must be or extend `DigitalCloud\ModelNotes\Note::class`.
     */
    'note_model' => DigitalCloud\ModelNotes\Note::class,

    /*
     * The name of the column which holds the ID of the model related to the notes.
     *
     * You can change this value if you have set a different name in the migration for the notes table.
     */
    'model_primary_key_attribute' => 'model_id',

];

use DigitalCloud\ModelNotes\HasNotes;

class YourEloquentModel extends Model
{
    use HasNotes;
}

$model->setNote('new note');

$allNotes = $model->notes;
bash
php artisan vendor:publish --provider="DigitalCloud\ModelNotes\ModelNotesServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="DigitalCloud\ModelNotes\ModelNotesServiceProvider" --tag="config"