vuer/notes
Larablocks Analysis
vuer/notes works with any PHP project: the latest release (1.1.0, Oct 6, 2016) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Oct 6, 2016)
- 118 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Oct 6, 2016.
- No releases in the last 12 months.
- First released: Oct 6, 2016.
- Monthly downloads: 118, up 36% from six months ago.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require vuer/notes |
|
| Latest Version: | 1.1.0 |
| License: | MIT |
| Last Updated: | Oct 6, 2016 |
| Links: | GitHub · Packagist |
Notes (Laravel 5 Package)
Installation
You can install this package via composer using this command:
composer require vuer/notes
Next, you must install the service provider:
// config/app.php
'providers' => [
...
Vuer\Notes\NotesServiceProvider::class,
];
Publish migration and configuration file:
php artisan vendor:publish
After the migration has been published you can create the notes table by running the migrations:
php artisan migrate
If you want you can change models in notes config file (config/notes.php):
/*
* The class name of the note model to be used.
*/
'note_model' => \Vuer\Notes\Models\Note::class,
/*
* The class name of the author model to be used.
*/
'author_model' => \App\User::class,
Usage
Preparing your model
To associate notes with a model, the model must implement the following trait:
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Vuer\Notes\Traits\HasNotes;
class User extends Model
{
use HasNotes;
...
}
Creating notes
You can create a note for the model like this:
$user = User::find(1);
$note = $user->createNote(['body' => 'Lorem ipsum...']);
To save note author you should add second parameter:
$note = $user->createNote(['body' => 'Lorem ipsum...'], \Auth::user());
If you want to save author name you need to create getNotesAuthorName method in author class. It is useful if you want to delete users and keep informations about notes authors.
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Vuer\Notes\Traits\HasNotes;
class User extends Authenticatable
{
use HasNotes;
public function getNotesAuthorName()
{
return trim(sprintf('%s %s', $this->name, $this->surname));
}
}
You can get all notes or 1 note:
$notes = $user->notes;
$note = $user->note;
You can use it to create model description:
protected $fillable = [
'description',
];
public function setDescriptionAttribute($value)
{
$this->updateOrCreateNote([], ['body' => $value]);
}
public function getDescriptionAttribute()
{
return $this->note ? $this->note->body : '';
}
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 1.1.0 | MIT | |
| 1.0.0 | MIT |