File uploads are nice. We were processing uploaded files in so many applications, that it became easier to make a single, polymorphic relation for reuse across applications and entities.
The Upload model is simple enough. It comes paired with traits, for both Models and Repositories, to provide the necessary functionality to relate to uploads.
- Add
"c4tech/upload": "1.x"to your composer requirements and runcomposer update. - Add
C4tech\Upload\ServiceProviderto your service providers config array. - Run
php artisan vendor:publishto get the migrations. - Run
php artisan migrateto set up the migrations. - (Optional) Edit
config/upload.phpand change entries inmodelsandreposto match your class names. - (Optional) Map the Repository Facades in your facades config array for fast access:
a.
"Upload" => "C4tech\Upload\Facade"

