PHPackages                             akatekno/attachable - 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. akatekno/attachable

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

akatekno/attachable
===================

A simple attachment extension for Laravel

1.0.1(2y ago)38MITPHPPHP ^8.1|^8.2CI failing

Since Mar 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AkateknoID/attachable)[ Packagist](https://packagist.org/packages/akatekno/attachable)[ RSS](/packages/akatekno-attachable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Akatekno ID Attachable
======================

[](#akatekno-id-attachable)

This is a simple package to implement multiple attachments in a model. This package is created based on my annoyance for creating the same model and migrations over and over. So this is why I made the Attachable package.

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

[](#installation)

In your Laravel application, run `composer require akatekno/attachable`, then run `php artisan migrate` to create the `attachments` table.

Usage
-----

[](#usage)

There are currently two types of the Attachable available:

1. `AttachableOne` if you want to implement only ONE attachment per-model. The case example is the User's profile picture, or the User's identity card.
2. `AttachableMany` if you want to implement many attachments per-model. The case example is a Blog's gallery picture, or a Report's attachments.

### `AttachableOne`

[](#attachableone)

The implementation of the code is fairly simple:

1. Implement the interface `AttachableOne` and trait `AttachableOne`

```
