lakely / laravel-admin-upload
laravel admin upload file direct
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: >=7.0.0
- encore/laravel-admin: ~1.6
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-04-20 00:07:14 UTC
README
####Intro Web direct upload, and can combine with upload manager system(if you application has).
####Install
composer require lakely/laravel-admin-upload
php artisan vendor:publish --tag=laravel-admin-upload
//添加上传路由与方法,自己去实现
$router->post('/file-upload', 'FileUploadController@fileUpload');
####Usage
$form->singleImage('logo', 'LOGO');
$form->multiImage('gallery', 'Gallery');
####Database tables and model
singleImage
saved asstring
andmultiImage
saved asJSON
type, so firstly,you need to define thecasts
property secondly,if you DB field type isvarchar
, you need to define amutator
######1.casts property
protected $casts = [
'gallery' => 'array',
];
######2.Defining a mutator: setXXXXAttribute()
if you database field is
Varchar
, you need the following. ifJSON
, do nothing
public function setGalleryAttribute($value)
{
$this->attributes['gallery'] = json_encode($value);
}