Dcat admin 七牛云文件上传

Dcat admin 七牛云文件上传

首先composer 

composer require zgldh/qiniu-laravel-storage:0.10.3

接下来修改配置在 config/filesystems.php 添加一项:

'disks' => [
    ... ,
    'qiniu' => [
            'driver'  => 'qiniu',
            'domains' => [
                'default'   => 'qzzfl07uf.hn-bkt.clouddn.com', //你的七牛域名
                'https'     => 'dn-yourdomain.qbox.me',         //你的HTTPS域名
                'custom'    => 'static.abc.com',                //Useless 没啥用,请直接使用上面的 default 项
            ],
            'access_key'=> 'wVQ_Q0xhOlbqjlda02316GuymOmwJq48lt_YB9SC',  //AccessKey
            'secret_key'=> '0973uDj-kRxA6VsvEXH-VxAh592oemjmhbXVSAB0',  //SecretKey
            'bucket'    => 'lanjinghexuan',  //Bucket名字
            'notify_url'=> '',  //持久化处理回调地址
            'access'    => 'public',  //空间访问控制 public 或 private
            'hotlink_prevention_key' => '', // CDN 时间戳防盗链的 key。 设置为 null 则不启用本功能。
//            'hotlink_prevention_key' => 'cbab68a279xxxxxxxxxxab509a', // 同上,备用
        ],
],

然后修改 dcat-admin 的上传配置,打开 config/admin.php 找到:


'upload'  => [

    'disk' => 'qiniu',

    'directory'  => [
        'image'  => 'image',
        'file'   => 'file',
    ],
],

然后在form方法下添加

$form->file('file')->disk('qiniu');

注:file里的内容为数据的字段

在展示方面

$grid->column('img')->image();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值