PHP code example of centrex / laravel-model-note

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

    

centrex / laravel-model-note example snippets


use Centrex\LaravelModelNote\HasNotes;

class YourEloquentModel extends Model
{
    use HasNotes;
}

$model->addNote('whatever you like');

$model->addNote('whatever you like' , true);

//or alternatively
$model->addPrivateNote('whatever you like');


$model->addNote('whatever you like' , false , "tag1");

//or for the private note
$model->addPrivateNote('whatever you like' , "tag2");


$model->note; // returns the text of the last note

$model->note(); // returns the last instance of `Centrex\LaravelModelNote\ModelNote`

//or alternatively
$model->lastNote(); // returns the last instance of `Centrex\LaravelModelNote\ModelNote`

$all_notes = $model->notes;

//or alternatively
$all_notes = $model->notes();


//last note of specific tag
$last_note = $model->lastNote("tag1"); 

//specific tag
$all_notes = $model->allNotes("tag1");

//specific tags
$all_notes = $model->allNotes("tag1" , "tag2");

//specific tag
$all_notes = $model->privateNotes("tag1");

//specific tags
$all_notes = $model->privateNotes("tag1" , "tag2");

//specific id
$model->deleteNote(1);

//specific ides
$model->deleteNote(1, 2, 3);


//specific tag
$model->deleteNoteByTag("tag1");

//specific tags
$model->deleteNoteByTag("tag1", "tag2", "tag3");


$model->deleteAllNotes();
bash
php artisan vendor:publish --tag="laravel-model-note-config"
bash
php artisan vendor:publish --tag="laravel-model-note-migrations"
php artisan migrate