nova-field-system-file,
Install
To install package, you need run command:
composer require akbsit/nova-field-system-fileNext install migrations:
php artisan migrateConnection
Package based on akbsit/laravel-system-file in repository which describes the connection to the model.
Examples
Second parameter is responsible for the collection to which the saved images or files will belong.
- Upload image:
public function fields(HttpRequest $oHttpRequest)
{
return [
Image::make(__('Image'), 'image'),
];
}- Upload file:
public function fields(HttpRequest $oHttpRequest)
{
return [
File::make(__('File'), 'file'),
];
}- Fields support validation via the method
rules:
public function fields(HttpRequest $oHttpRequest)
{
return [
Image::make(__('Image'), 'image')
->rules('required', 'max:1000'),
File::make(__('File'), 'file')
->rules('required', 'max:5000'),
];
}Methods and properties
enablePartition()- enable folder generation (example:73c/d53/dce);setOriginFileName(string $sOriginFileName)- set origin file name;setFileName(string $sFileName)- set file name;toDir(string $sDir)- set storage folder (by defaultdefault);self()- specified if the modelSystemFile(by defaultfalse).