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

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

otsglobal/laravel-attachments
=============================

Attach files to your models, retrievable by key, group name or using the Eloquent relationship.

v1.0.0(1y ago)02MITPHPPHP &gt;=8.2

Since May 4Pushed 1y agoCompare

[ Source](https://github.com/Open-Technology-Solutions/laravel-attachments)[ Packagist](https://packagist.org/packages/otsglobal/laravel-attachments)[ RSS](/packages/otsglobal-laravel-attachments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

Laravel 8.37+ file attachment helpers
=====================================

[](#laravel-837-file-attachment-helpers)

> This repo is fork of `bnbwebexpertise/laravel-attachments` by [B&amp;B Web Expertise](https://github.com/bnbwebexpertise/laravel-attachments)

This package allows to quickly attach files to your models, retrievable by key, group name or using the Eloquent relationship.

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

[](#installation)

You can install this package via composer.

```
composer require otsglobal/laravel-attachments

```

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

[](#configuration)

You can customize this package behavior by publishing the configuration file :

```
php artisan vendor:publish --provider='Otsglobal\Laravel\Attachments\AttachmentsServiceProvider' --tag="config"

```

Migrations
----------

[](#migrations)

This package will load the migrations but if you don't want, you can publish migrations and stop loading of migrations `AttachmentsServiceProvider::ignoreMigrations()` by package.

```
php artisan vendor:publish --provider="Otsglobal\Laravel\Attachments\AttachmentsServiceProvider" --tag="migrations"

php artisan migrate

```

Add the following line in your in AppServiceProvider's register method

```
\Otsglobal\Laravel\Attachments\AttachmentsServiceProvider::ignoreMigrations();

```

Add attachments to a model class
--------------------------------

[](#add-attachments-to-a-model-class)

Add the `HasAttachment` trait to your model class :

```
