Download the PHP package fahedaljghine/laravel-model-note without Composer
On this page you can find all versions of the php package fahedaljghine/laravel-model-note. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fahedaljghine/laravel-model-note
More information about fahedaljghine/laravel-model-note
Files in fahedaljghine/laravel-model-note
Package laravel-model-note
Short Description A package to enable assigning notes to Eloquent Models
License MIT
Homepage https://github.com/fahedaljghine/laravel-model-note
Informations about the package laravel-model-note
Add notes to Eloquent models
This package provides a HasNotes
trait that, once installed on a model, allows you to do things like this:
Contact Me
You can check all of my information by Checking my website.
Installation
You can install the package via composer:
You must publish the migration with:
Migrate the notes
table:
Optionally you can publish the config-file with:
This is the contents of the file which will be published at config/model-note.php
Usage
Add the HasNotes
trait to a model you like to use notes on.
Add a new note
You can add a new note like this:
Add a private note
You can add a new private note which can be seen only be you like this:
Add a note with tag
Sometimes you will need to tag your note with some tag which can be done like this:
Retrieving notes
You can get the last note of model:
All associated notes of a model can be retrieved like this:
All associated notes of a model with specific tag or tags can be retrieved like this:
All associated private notes of a model with specific tag or tags can be retrieved like this:
Delete a note from model
You can delete any note that has been added on the model by id at any time by using the deleteNote
method:
You can delete any note that has been added on the model by tag at any time by using the deleteNote
method:
Delete all notes from model
You can delete all notes that had been added on the model at any time by using the deleteAllNotes
method:
Delete all notes from model:
Custom model and migration
You can change the model used by specifying a class name in the note_model
key of the model-note
config file.
You can change the column name used in the notes table (model_id
by default) when using a custom migration where you
changed
that. In that case, simply change the model_primary_key_attribute
key of the model-note
config file.
Changelog
Please see CHANGELOG for more information what has changed recently.
Dontae
Contributing
You are welcome to contribute
Credits
- Fahed Aljghine
- All Contributors
License
The MIT License (MIT). Please see License File for more information.