LaravelPackages.net
Acme Inc.
Toggle sidebar
blocksystems/file-attributes

service model attributes for laravel(lumen) by files

3
0
About blocksystems/file-attributes

blocksystems/file-attributes is a Laravel package for service model attributes for laravel(lumen) by files. It currently has 0 GitHub stars and 3 downloads on Packagist. Install it with composer require blocksystems/file-attributes. Discover more Laravel packages by blocksystems or browse all Laravel packages to compare alternatives.

Last updated

Version License

Document

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'

Star History Chart