PHPackages                             oi-lab/oi-laravel-notes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oi-lab/oi-laravel-notes

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oi-lab/oi-laravel-notes
=======================

Polymorphic notes with attachments for Laravel applications

v1.0.5(3w ago)1156↑200%MITPHPPHP ^8.2CI failing

Since Jun 14Pushed 3w agoCompare

[ Source](https://github.com/oi-lab/oi-laravel-notes)[ Packagist](https://packagist.org/packages/oi-lab/oi-laravel-notes)[ RSS](/packages/oi-lab-oi-laravel-notes/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (19)Versions (7)Used By (0)

[![OI Laravel Notes](./assets/github-preview.png)](./assets/github-preview.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/46163e5c34063def4058af32ed9286fd941667a38ba8202938cd72fd418da9c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f692d6c61622f6f692d6c61726176656c2d6e6f7465732e737667)](https://packagist.org/packages/oi-lab/oi-laravel-notes)[![Total Downloads](https://camo.githubusercontent.com/f7e73697be7926a18094d98943a7631aee62760c3326fcc50445286858526cc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f692d6c61622f6f692d6c61726176656c2d6e6f7465732e737667)](https://packagist.org/packages/oi-lab/oi-laravel-notes)[![Tests](https://camo.githubusercontent.com/a79acda2a6014b2da6e65ed6829c93dfce8c70ef7db33c3da5ba09cb5d220714/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f692d6c61622f6f692d6c61726176656c2d6e6f7465732f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/oi-lab/oi-laravel-notes/actions)[![License](https://camo.githubusercontent.com/cfc4e6923ebf28e3ec46241359c82dda62c8986f2420acb0c8e55619fdfad7a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f692d6c61622f6f692d6c61726176656c2d6e6f746573)](LICENSE)

OI Laravel Notes
================

[](#oi-laravel-notes)

A Laravel package for polymorphic notes. Attach notes to **any** Eloquent model, author them with a user, flag machine-generated notes, and attach files to them — built on top of `oi-laravel-attachments`.

Features
--------

[](#features)

- **Polymorphic Notes**: Annotate any model via a single `HasNotes` trait
- **Authored &amp; Bot Notes**: Optional author plus a `has_bot` flag for system-generated notes
- **File Attachments**: Notes are attachable — attach files via `oi-laravel-attachments`
- **Validation**: A ready-made `NoteRequest` form request with configurable file limits
- **Configurable Models**: Swap in your own `Note` or user model subclasses
- **UUIDs &amp; Soft Deletes**: Every note has a unique `uuid` and is soft-deletable

How It Works
------------

[](#how-it-works)

The package revolves around a single `Note` model attached polymorphically to a `notable` parent. Host models opt in with the `HasNotes` trait, which exposes a `notes()` relationship. The `Note` model itself uses the `HasAttachments` trait, so any note can carry files. All package internals resolve model classes through the `OiNotes` resolver, so you can override the `Note` or user model from config without touching package code.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+, 12.0+, or 13.0+
- [`oi-lab/oi-laravel-attachments`](https://packagist.org/packages/oi-lab/oi-laravel-attachments) ^1.0

Installation
------------

[](#installation)

```
composer require oi-lab/oi-laravel-notes
```

The package auto-discovers and registers its service provider — no manual registration required.

### Local Development

[](#local-development)

For local development inside the monorepo, add a path repository to your main project's `composer.json`:

```
{
    "repositories": [
        {
            "type": "path",
            "url": "./packages/oi-lab/oi-laravel-notes"
        }
    ]
}
```

Then:

```
composer require oi-lab/oi-laravel-notes
```

### Publish &amp; Migrate

[](#publish--migrate)

Publish the migrations (and optionally the config) and run them:

```
php artisan vendor:publish --tag=oi-laravel-notes-migrations
php artisan vendor:publish --tag=oi-laravel-notes-config
php artisan migrate
```

This creates the `notes` table.

Configuration
-------------

[](#configuration)

The config file `config/oi-laravel-notes.php` exposes the following options:

```
return [
    // Model used for the note author relationship
    'user_model' => 'App\Models\User',

    // Model classes used by the package — override with your own subclasses
    'models' => [
        'note' => OiLab\OiLaravelNotes\Models\Note::class,
    ],

    // Validation limits applied by NoteRequest
    'attachments' => [
        'max_files' => 10,
        'max_file_size' => 10240, // kilobytes
    ],
];
```

Usage
-----

[](#usage)

### Make a Model Notable

[](#make-a-model-notable)

Add the `HasNotes` trait to any model:

```
use Illuminate\Database\Eloquent\Model;
use OiLab\OiLaravelNotes\Concerns\HasNotes;

class Order extends Model
{
    use HasNotes;
}
```

### Create &amp; Read Notes

[](#create--read-notes)

```
$order->notes()->create([
    'message' => 'Customer called to confirm the address.',
    'user_id' => auth()->id(),
]);

$order->notes;            // all notes (MorphMany)
$order->notes()->latest()->first();
```

### Bot / System Notes

[](#bot--system-notes)

```
$order->notes()->create([
    'message' => 'Status automatically advanced to shipped.',
    'has_bot' => true,
]);
```

### Attach Files to a Note

[](#attach-files-to-a-note)

A `Note` is attachable via `oi-laravel-attachments`:

```
use OiLab\OiLaravelAttachments\Actions\AttachUploadedFiles;

$note = $order->notes()->create(['message' => 'Signed delivery slip attached.']);

AttachUploadedFiles::handle($note, $request->file('files'));

$note->attached_files; // Collection of File models
```

### Validating Input

[](#validating-input)

`OiLab\OiLaravelNotes\Http\Requests\NoteRequest` validates the message and uploaded files against the configured limits. Use it directly in a controller or extend it for your own rules.

Overriding the Note Model
-------------------------

[](#overriding-the-note-model)

Resolve models through `OiNotes` so your overrides apply everywhere:

```
// config/oi-laravel-notes.php
'models' => [
    'note' => App\Models\Note::class, // extends OiLab\OiLaravelNotes\Models\Note
],
```

AI Assistant Skills
-------------------

[](#ai-assistant-skills)

Install Claude Code / JetBrains Junie skill files and a `CLAUDE.md` rules section into your app:

```
php artisan oi:skills
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE) for more information.

Credits
-------

[](#credits)

**[Olivier Lacombe](https://www.olacombe.com)** - Creator and maintainer

Olivier is a Product &amp; Technology Director based in Montpellier, France, with over 20 years of experience innovating in UX/UI and emerging technologies. He specializes in guiding enterprises toward cutting-edge digital solutions, combining user-centered design with continuous optimization and artificial intelligence integration.

**Projects &amp; Resources:**

- [OI Dev Docs](https://dev.olacombe.com) - Documentation for all Open Source OI Lab packages
- [OnAI](https://onai.olacombe.com) - Training courses and masterclasses on generative AI for businesses
- [Promptr](https://promptr.olacombe.com) - Prompt engineering Management Platform

Support
-------

[](#support)

For support, please open an issue on the [GitHub repository](https://github.com/oi-lab/oi-laravel-attachments/issues).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance95

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

6

Last Release

23d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/369876?v=4)[Olivier Lacombe](/maintainers/olacombe)[@olacombe](https://github.com/olacombe)

---

Top Contributors

[![olacombe](https://avatars.githubusercontent.com/u/369876?v=4)](https://github.com/olacombe "olacombe (10 commits)")

---

Tags

laravelnotespackagepolymorphiclaravelannotationscommentsnotesattachmentspolymorphic

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/oi-lab-oi-laravel-notes/health.svg)

```
[![Health](https://phpackages.com/badges/oi-lab-oi-laravel-notes/health.svg)](https://phpackages.com/packages/oi-lab-oi-laravel-notes)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k21](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
