Skip to content

A production-ready Laravel file uploader with: - Polymorphic relations - Public & private files - Local / S3 support - Image optimization - Auto cleanup on model delete

License

Notifications You must be signed in to change notification settings

codeflextech/laravel-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeFlexTech Laravel Uploader

A production-ready Laravel file uploader with:

  • Polymorphic relations
  • Public & private files
  • Local / S3 support
  • Image optimization
  • Auto cleanup on model delete

Installation

composer require codeflextech/laravel-uploader

Basic Usage

1. Add Trait to Model

Add the HasFiles trait to any model that should have files attached (e.g., User, Post, Product).

use CodeFlexTech\Uploader\Traits\HasFiles;

class User extends Authenticatable
{
    use HasFiles;
}

2. Upload a File

Use the FileUploader facade or class to handle uploads.

use CodeFlexTech\Uploader\FileUploader;

FileUploader::upload(
    $request->file('avatar'),
    $user, // The model instance (owner)
    [
        'folder' => 'avatars',
        'disk'   => 'public', // or 's3'
    ]
);

License

MIT

About

A production-ready Laravel file uploader with: - Polymorphic relations - Public & private files - Local / S3 support - Image optimization - Auto cleanup on model delete

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages