jaysson/eloquent_filefield

Automatically save files assigned to eloquent model attributes
1,750 4
Install
composer require jaysson/eloquent_filefield
Latest Version:1.0.1
PHP:~5.5|~7.0
License:MIT
Last Updated:Mar 29, 2020
Links: GitHub  ·  Packagist
Maintainer: jaysson

Eloquent File Field

Easily upload files to a directory and save the filename to database attribute.

It does not handle any image processing. Take a look at [Glide][http://glide.thephpleague.com] for that.

Install

Via Composer

$ composer require jaysson/eloquent_filefield

Usage

In your Eloquent model:

use Jaysson\EloquentFileField\FileFieldTrait;

public $fileFields = [
  'image' => [],
  'poster' => [
  	'disk' => app('config')->get('filesystems.default'),
    'path' => 'uploads/:class_slug/:attribute/:unique_id-:file_name',
    'default_path' => 'uploads/default.png'
  ]
];

Each field can have filesystem disk, path pattern and default path options. If you don't specify any of them, they will be loaded from default config.

Publish default config

$ php artisan vendor:publish 

Security

If you discover any security related issues, please email prabhakarbhat@live.com instead of using the issue tracker.

License

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

Related Packages

hollogram/laravel-stapler

Easy file upload management for the Laravel Framework.

809 0
codesleeve/laravel-stapler

Easy file upload management for the Laravel Framework.

415,387 556
reich/upload

A great class to upload your file or files to the server, could be integreted wi...

135 10
shcode/laravel-stapler-gcs

GCS support for CodeSleeve/laravel-stapler

10 0
cyneek/laravel-multiple-stapler

Multiupload for Laravel Stapler.

503 2