PHPackages                             andach/laravel-attachments-comments - 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. andach/laravel-attachments-comments

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

andach/laravel-attachments-comments
===================================

This is a Laravel package to allow you to add comments and attachments to models.

v1.0.1(2y ago)064MITPHPPHP ^8.1

Since Sep 18Pushed 2y agoCompare

[ Source](https://github.com/andach-limited/laravel-attachments-comments)[ Packagist](https://packagist.org/packages/andach/laravel-attachments-comments)[ Docs](https://github.com/andach-limited/laravel-attachments-comments)[ RSS](/packages/andach-laravel-attachments-comments/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Attachments and Comments by Andach
==========================================

[](#laravel-attachments-and-comments-by-andach)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d197fe6efb7cd69abbb2f9ab3615870d9426bec3642e393c02409f4a3e7b6a47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e646163682f6c61726176656c2d6174746163686d656e74732d636f6d6d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andach/laravel-attachments-comments)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ba195692a15f2bafaa258a300fb2bb300cc19040b850de945cdf18fdedddd4d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616e646163682f6c61726176656c2d6174746163686d656e74732d636f6d6d656e74732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/andach/laravel-attachments-comments/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6faf1efa2a961503cba41ab7e967f8a5d4edd019e74e0912145cb0eb8ca8d926/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616e646163682f6c61726176656c2d6174746163686d656e74732d636f6d6d656e74732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/andach/laravel-attachments-comments/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1807166695348de1c9842f053c4fb01410abf700b16801da779599f81a88dbf7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e646163682f6c61726176656c2d6174746163686d656e74732d636f6d6d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andach/laravel-attachments-comments)

This is a Laravel package for adding Attachments and Comments to any model.

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

[](#installation)

You can install the package via composer:

```
composer require andach-limited/laravel-attachments-comments
```

You should then publish the config and migrations with:

```
php artisan attachments-comments:install
```

Usage
-----

[](#usage)

### Using a Trait

[](#using-a-trait)

To add the relations to a model, simply add the `MorphToAttachmentsAndComments` trait to the model. If only one is needed, then just use `MorphToAttachments` or `MorphToComments` by themselves.

```
class MyModel extends Model
{
    use MorphToAttachmentsAndComments;

    // ...
}

```

### Adding Attachments and/or Comments

[](#adding-attachments-andor-comments)

To actually add an attachment or a comment, you can use the `addAttachmentAndComment()`. This accepts a single string and an optional UploadedFile.

```

    @csrf

    Submit

```

And in the relevant controller method...

```
public function store(Request $request)
{
    $model = MyModel::create();

    $model->addAttachmentAndComment($request->comment, $request->attachment);

    return redirect()->route('my-model.show', $model);
}

```

If handed an empty string or null attachment, the system will not create an attachment or comment silently.

### Retrieving Attachments and Comments

[](#retrieving-attachments-and-comments)

The relations are all handled by the traits, so you can just call:

```
$model = new MyModel();

foreach ($model->attachments as $attachment)
{
    // ...
}

foreach ($model->comments as $comment)
{
    // ...
}

```

### Displaying Comments and Attachments

[](#displaying-comments-and-attachments)

```

```

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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 ~8 days

Total

2

Last Release

956d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14134660effc2fe199c32c19c6749473faf24b3944bd15dcf34dd9e088f8f095?d=identicon)[andach-andreas](/maintainers/andach-andreas)

---

Top Contributors

[![andach-andreas](https://avatars.githubusercontent.com/u/140014241?v=4)](https://github.com/andach-andreas "andach-andreas (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelandachlaravel-attachments-comments

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/andach-laravel-attachments-comments/health.svg)

```
[![Health](https://phpackages.com/badges/andach-laravel-attachments-comments/health.svg)](https://phpackages.com/packages/andach-laravel-attachments-comments)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M626](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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