PHPackages                             dcodegroup/laravel-attachments - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. dcodegroup/laravel-attachments

ActiveLibrary[File &amp; Storage](/categories/file-storage)

dcodegroup/laravel-attachments
==============================

Allow adding attachments to any document

1.0.5(10mo ago)128.3k↓36.3%MITVuePHP ^8.2 || ^8.3 || ^8.4CI passing

Since Jun 14Pushed 4mo ago5 watchersCompare

[ Source](https://github.com/DCODE-GROUP/laravel-attachments)[ Packagist](https://packagist.org/packages/dcodegroup/laravel-attachments)[ RSS](/packages/dcodegroup-laravel-attachments/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (35)Used By (0)

Laravel Attachments
===================

[](#laravel-attachments)

Simple Dropin package to add attachments to your models.

[![Latest Version on Packagist](https://camo.githubusercontent.com/edef368b71dae22abe76ea84154360ac9bcde29de51b87136418290f659096cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64636f646567726f75702f6c61726176656c2d6174746163686d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcodegroup/laravel-attachments)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/338b3ee9ad4dea1019d1ed11feca7e6a9643a6e3df6e0b5da892e641e12731cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f44434f44452d47524f55502f6c61726176656c2d6174746163686d656e74732f63692e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/DCODE-GROUP/laravel-attachments/actions/worflows/ci.yml/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/f193c9fdd0fecfc70e0ed6fa7b275a9ba075f7b4da525a4cf6c168e6b8824a3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64636f646567726f75702f6c61726176656c2d6174746163686d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcodegroup/laravel-attachments)

Install
-------

[](#install)

Version / BranchLaravel SupportInstall Command0.x&lt;= v10`composer require dcodegroup/laravel-attachments:^0.0`1.x&gt;= v11`composer require dcodegroup/laravel-attachments:^1.0`Then run

```
php artisan vendor:publish --provider="Dcodegroup\LaravelAttachments\LaravelAttachmentsServiceProvider"
```

Database
--------

[](#database)

If you are using either `ULIDS` or `UUIDs` in your tables ensure to update the published migrations for the `media` table.

eg. replace with the appropriate type

```
    Schema::create('media', function (Blueprint $table) {
    ...
        $table->nullableMorphs('model');
        $table->nullableMorphs('parent_model');
```

or

```
    Schema::create('media', function (Blueprint $table) {
    ...
        $table->nullableUlidMorphs('model');
        $table->nullableUlidMorphs('parent_model');
```

Then run the migrations

```
## Routes

Add the Routes to the file you need such as `laravel_attachments.php`

```php
as(config('attachments.route_name_prefix').'.')->prefix('attachments')->group(base_path('routes/laravel_attachments.php'));
```

Frontend
--------

[](#frontend)

Add the following file to to your css file.

```
 @import "../../vendor/dcodegroup/laravel-attachments/resources/scss/attachments.scss";
```

Add the below to the `app.js` file.

```
import attachmentPlugin from "../../vendor/dcodegroup/laravel-attachments/resources/js/plugin"

app.use(attachmentPlugin)
```

Ensure to install these npm packages

```
npm i @heroicons/vue bytes form-backend-validation vue-image-markup vue-upload-component
```

config
------

[](#config)

Configuration file contains

```
