laravel admin 配置阿里云oss
一、安装驱动
composer require jacobcyl/ali-oss-storage:dev-master
二、添加provider
acobcyl\AliOSS\AliOssServiceProvider::class,
三、配置 app/filesystems.php
'oss' => [
'driver' => 'oss',
'domains' => [
'default' => 'http://zhongguomayun.oss-cn-hangzhou.aliyuncs.com/', //你的七牛域名
'https' => 'dn-yourdomain.qbox.me', //你的HTTPS域名
'custom' => 'static.abc.com', //你的自定义域名
],
'access_id' => 'Qxs5dTOIPfqk8209V',
'access_key' => 'ZrbJYCpTQV9uvJmFHMBxNRP6dDgCfWJo',
'bucket' => 'zhongguomayun',
'endpoint' => 'oss-cn-hangzhou.aliyuncs.com',
'isCName' => false,
'debug' => false,
'url' =>'http://zhongguomayun.oss-cn-hangzhou.aliyuncs.com/',
],
设置默认驱动 app/filesystems.php:
'default' => 'oss',
四、修改laravel-admin的上传配置,打开config/admin.php找到
'upload' => [
'disk' => 'oss',
'directory' => [
'image' => 'image',
'file' => 'file',
],
],
disk选择 oss
五、使用图片控件
$form->image('thumb', '缩略图')->removable();