定制 fdt2k/backpack-custom-fields 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fdt2k/backpack-custom-fields

Composer 安装命令:

composer require fdt2k/backpack-custom-fields

包简介

Custom fields for backpack

README 文档

README

yarn 

yarn mix
sail artisan vendor:publish --provider="KDA\Backpack\Field\CustomFieldServiceProvider" --tag="public" --force

Croppable Image Field

install

sail composer require intervention/image

and follow https://image.intervention.io/v2/introduction/installation#integration-in-laravel

CRUD::addField([
        'label' => "Couverture",
        'name' => "cover",
        'type' => 'imagecrop',
        'tab'=> 'Media',

        // imagecrop
        'original_field'=> 'original',
        'metadata_field'=> 'crop',
        'crop' => true, // set to true to allow cropping, false to disable
        'aspect_ratio' => 1, // omit or set to 0 to allow any aspect ratio
        //'crop' => true, // set to true to allow cropping, false to disable
        //'aspect_ratio' => 1, // omit or set to 0 to allow any aspect ratio
        // 'disk'      => 's3_bucket', // in case you need to show images from a different disk
        // 'prefix'    => 'uploads/images/profile_pictures/' // in case your db value is only the file name (no path), you can use this to prepend your path to the image src (in HTML), before it's shown to the user;
    ]);

Model trait

cast your attribute as array and use the Croppable trait

class Book extends Model {
    use \KDA\Backpack\Field\Model\Croppable;
    protected $casts = [
        'cover'=> 'array',
        ...
    ]

    protected $croppable = [
    
        'cover'=>[ // field name
            'path'=> 'press' // path in storage
        ]
    ];

统计信息

  • 总下载量: 111
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固