PHPackages                             padosoft/laravel-uploadable - 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. padosoft/laravel-uploadable

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

padosoft/laravel-uploadable
===========================

Laravel package for automatic upload handling with trait

5.4.0(1y ago)2813.6k↓46.7%4[2 PRs](https://github.com/padosoft/laravel-uploadable/pulls)MITPHPPHP &gt;=7.0.0

Since Aug 14Pushed 9mo ago5 watchersCompare

[ Source](https://github.com/padosoft/laravel-uploadable)[ Packagist](https://packagist.org/packages/padosoft/laravel-uploadable)[ Docs](https://github.com/padosoft/laravel-uploadable)[ RSS](/packages/padosoft-laravel-uploadable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (21)Used By (0)

Auto upload handling with Eloquent models trait
===============================================

[](#auto-upload-handling-with-eloquent-models-trait)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3fad4855733770216737eb88a563e44f572fd6cdd6637c06db3f392f0ee9c82e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061646f736f66742f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-uploadable)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/68d50fd9c9721b21a82388adfbd9ca5b306530c54b425167e517a8d1231b98e0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7061646f736f66742f6c61726176656c2d75706c6f616461626c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/padosoft/laravel-uploadable)[![Quality Score](https://camo.githubusercontent.com/122f5d05ba7b1ebac1169f1c29e8e0ac01e2ae2eafa4d5011a58807b72dc9608/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7061646f736f66742f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/padosoft/laravel-uploadable)[![Total Downloads](https://camo.githubusercontent.com/e1dd67d5918da992de9ca6cbd50169f4af59c90c073ef4018a3269abb1eb60c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061646f736f66742f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-uploadable)

This package provides a trait that will automatic handlind upload when saving/updating/deleting any Eloquent model with upload form request.

\##Requires

- php: &gt;=7.1
- illuminate/database: ^5.7|^6.0|^7.0|^8.0|^9.0
- illuminate/support: ^5.7|^6.0|^7.0|^8.0|^9.0
- illuminate/http: ^5.7|^6.0|^7.0|^8.0|^9.0
- padosoft/io: "^1.9",
- padosoft/laravel-request: "^1.0|^2.0",
- padosoft/support: "^1.6|^2.1|^3.0.4"
-

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

[](#installation)

You can install the package via composer:

```
$ composer require padosoft/laravel-uploadable
```

Usage
-----

[](#usage)

Your Eloquent models should use the `Padosoft\Uploadable\Uploadable` trait and the `Padosoft\Uploadable\UploadOptions` class.

You can define `getUploadOptions()` method in your model.

Here's an example of how to implement the trait with implementation of getUploadOptions():

```
