surpaimb / laravel-admin-alioss
扩展laravel-admin的form表单,使其可以使用web直传阿里OSS
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: ^7.3|^8.0
- aliyuncs/oss-sdk-php: ~2.0
- encore/laravel-admin: ~1.6
Requires (Dev)
- phpunit/phpunit: ^6.0
README
扩展laravel-admin的表单,实现web直传阿里OSS
截图
安装
composer require surpaimb/laravel-admin-alioss
php artisan vendor:publish --provider=Surpaimb\AliOssUpload\AliOssUploadServiceProvider
配置
在config/admin.php文件的extensions,加上属于这个扩展的一些配置
'extensions' => [ 'alioss-upload' => [ 'OSS_ACCESS_ID' => '*****', 'OSS_ACCESS_KEY' => '**************', 'OSS_ENDPOINT' => 'oss-cn-shanghai.aliyuncs.com', 'OSS_BUCKET' => '*****', 'OSS_HOST' => 'http://****.oss-cn-shanghai.aliyuncs.com', 'OSS_URL' => 'http://***.oss-cn-shanghai.aliyuncs.com' // 自定义域名(CDN) ] ],
使用
在form表单中使用它
$form->aliOss('pic', '图片')->attribute('image'); // 单图(默认) $form->aliOss('pic2', '图片2')->attribute('images'); // 多图 $form->aliOss('pic3', '图片2')->attribute('file'); // 多图