umobi/laravel-simple-storage

1.0.1 2020-08-08 00:04 UTC

This package is auto-updated.

Last update: 2024-11-08 09:54:09 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package can associate all sorts of files with Eloquent models. It provides a simple API to work with. To learn all about it, head over to the extensive documentation.

Installation

You can install the package via composer:

composer require umobi/package-laravel-simple-storage-laravel

Usage

Here are a few short examples of what you can do:

class User extends Model implements StorageFieldsContract {
    use StorageFieldsTrait;
    protected $files = [
        'image' => [
            'path' => 'users',
            'type' => 'image',
            'extension' => 'jpg',
            'default' => 'default.png',
            'size' => [300, 300],
            'disk' => 'public'
        ],
    ];
}
$user = new User();
$user->name = 'Jane Doe';
$user->image = UploadFile|File|Url;
$user->save();
<img src="{!! $user->image !!}">

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email freek@umobi.be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.