haymetg / laranote
A lightweight model note maker
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/haymetg/laranote
Requires (Dev)
- orchestra/testbench: ^7.0@dev
README
- Install Laranote composer require haymetg/laranote
- Run php artisan vendor:publish --provider="HaymeTG\Laranote\LaranoteServiceProvider"
- Use HasLaranotetrait for models with notes.
- Use it.
Trait Methods:
createNote()
for creating a note
example: $user->createNote('Im a note');
will fetch all notes saved in the model.
getNote($index)
for updating a note
example: $user->getNote($index);
will get note by index saved in the model.
Please note that this will only return note belong to parent model
updateNote($index, $noteText)
for updating a note
example: $user->updateNote($index);
will update note by index saved in the model.
Please note that this will only update note belong to parent model
deleteNote($index)
for deleting a note
example: $user->deleteNote($index);
will delete note by index saved in the model.
Please note that this will only delete note belong to parent model
deleteAll()
for deleting a note
example: $user->deleteAll();
will delete all note saved in the model.
Please note that this will only delete note belong to parent model
Trait Accessors:
- 
notes example: $user->notesWill retrieve all notes saved. This will return a collection
- 
first_note example: $user->first_noteWill retrieve the first note created by id.
- 
last_note example: $user->last_noteWill retrieve the last note created by id.
- 
latest_note example: $user->latest_noteWill retrieve the latest note created by date.
Model Accessors:
- laranotable
example: $user->laranotableWill retrieve the parent model of a laranote.