2017 © Pedro Peláez
 

library eloquent-uploadable

A trait to automatically handle file uploads for Laravel models.

image

sergeymiracle/eloquent-uploadable

A trait to automatically handle file uploads for Laravel models.

  • Thursday, February 8, 2018
  • by SergeyMiracle
  • Repository
  • 1 Watchers
  • 1 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 15 % Grown

The README.md

Eloquent Uploadable

A trait to automatically handle file uploads for Laravel Eloquent models., (*1)

Installation

composer require sergeymiracle/eloquent-uploadable, (*2)

Example Usage

use SergeyMiracle\Uploadable\UploadableModelTrait;
use Illuminate\Database\Eloquent\Model;

class Post extends Model {

  use UploadableModelTrait;

  // define options function
  public function getUploadableOptions(): array
  {
    return [
        'attributes' => [ // model attributes which you'd like to be automatically handled by the trait.
            'featured_image',
            'featured_file'
        ],
        'directory' => 'my_dir', // destination directory, optional
        'disk' => 'my_disk' // flysystem disk, optional, if not present in return array disk from config file used
    ];
  }

}

On saving array of files, a json encoded string saved in database., (*3)

Changelog

  • 3.1.0 - added new config options for filename generation
  • 3.0.0 - remove options - uploadables, use function getUploadableOptions() instead
  • 2.0.0 - removed UtilsTrait.php and UploadableControllerTrait.php, UploadableFileHandler can be used instead, php 7.2

The Versions

08/02 2018

dev-master

9999999-dev

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

08/02 2018

1.1.6

1.1.6.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

31/08 2017

1.1.5

1.1.5.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

30/08 2017

1.1.4

1.1.4.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

30/08 2017

1.1.3

1.1.3.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

30/08 2017

1.1.2

1.1.2.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

30/08 2017

1.1.1

1.1.1.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

30/08 2017

1.1.0

1.1.0.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

12/05 2017

1.0.1

1.0.1.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle

03/03 2017

1.0.0

1.0.0.0

A trait to automatically handle file uploads for Laravel models.

  Sources   Download

MIT

The Requires

 

by Avatar SergeyMiracle