Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.
/ uploadable Public archive

A trait to automatically handle file uploads for Laravel models.

Notifications You must be signed in to change notification settings

mxkxf/uploadable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uploadable

A trait to automatically handle file uploads for Laravel models.

Example Usage

Here's the package integrated into a bog-standard Laravel 5 model.

use MikeFrancis\Uploadable\Uploadable;
use Illuminate\Database\Eloquent\Model;

class Post extends Model {

  use Uploadable;

  protected $uploadables = ['featured_image'];

}

Let's break it down. First we include the trait we're going to take advantage:

use MikeFrancis\Uploadable\UploadableTrait;

Then in our model we use the trait:

use UploadableTrait;

Our model's $uploadables is an array of file input name attributes which you'd like to be automatically handled by the trait.

It's as simple as that. Standby for more features coming soon!

About

A trait to automatically handle file uploads for Laravel models.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages