Downloads
Stars
Version
file attributes for laravel(lumen)
this composer auto upload files and delete before files
[in your model class]
protect $fileable = ['thumbnail', 'profile'];
e.g
(when model creating)
User::create(['thumbnail' => $request->file('thumbnail'), 'profile' => $request->file('profile')]);
$user->thumbnail; // will be 's3 or local path'
e.g
(multiple files ※but if you want that, please cast your attribute to json like "php protected $casts = ['attirbute' => 'json']
")
User::create(['thumbnail' => [$request->file('thumbnail'), $request->file('profile')]]);
##Set prefix file path
protect $filablePrefix = 'admin'; // including slash or not, everything is OK.
##Set file path
protect $filablePath = 'admin/files'; // including slash or not, everything is OK.
##Set turn off automatically deleting file when attributes changed or deleted
protect $fileAutoDeleting = false; // default : true
##Everytime when attribute get changed value, will change dynamically file to url string
protect $fileableSync = true; // default : false
e.g
$user->thumbnail = $request->file('thumbnail');
// (without saving) will be 's3 or local path'