📋Adding to models

Settings

Start of by importing the trait in the model you are using

use NaN\NanNotesController\Traits\HasNotes;

Model

Add the trait HasNotes to the model you want to use notes on:

class PurchaseOrderLine extends NaNModel {
    use HasNotes;
    
    //.....
}

After adding it to the model you can mutate noted on the model as a notes() relation:

Example:

$PurchaseOrderLine = PurchaseOrderLine::find(1);
$notes = $PurchaseOrderLine->notes();

Last updated