PHPackages                             dcodegroup/laravel-attachments-backend - 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-backend

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

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

Allow adding attachments to any document

v0.0.2(1mo ago)0277↓85.8%MITPHPPHP ^8.2 || ^8.3 || ^8.4CI failing

Since May 31Pushed 1mo agoCompare

[ Source](https://github.com/DCODE-GROUP/laravel-attachments-backend)[ Packagist](https://packagist.org/packages/dcodegroup/laravel-attachments-backend)[ RSS](/packages/dcodegroup-laravel-attachments-backend/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (10)Versions (3)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'));
```

Backend-only package
--------------------

[](#backend-only-package)

This package provides configuration, migrations, models, route macros, controllers, requests, translations, and media-library integration only. Build any attachment UI in your application and call the backend routes registered by this package.

config
------

[](#config)

Configuration file contains

```
