mvaliolahi/attachable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mvaliolahi/attachable

Composer 安装命令:

composer require mvaliolahi/attachable

包简介

This package allows you to attach files to Eloquent models.

README 文档

README

Installation

$ composer require mvaliolahi/attachable
class Post extends Model
{
    use Attachable;

    protected $attachable = [
        'image',
        'cover'
    ];

    public function coverUrl()
    {
        return asset(Storage::url($this->cover));
    }

Change upload path

By default, files will be uploaded to the public directory, but you can change it by adding the $upload_path property to your model.

protected $upload_path = 'public';

Separate files for each user

This property is optional and allows each user's files to be saved in a separate folder.

protected $user_directory = true;

Resize Images

This property is optional.

protected $resize_image = [
    'avatar' => [
        'fit' => true, // default is false and will resize the image to the given size
        'width' => 200,
        'height' => 200,
        'quality' => 90 # this is optional, default is 100
        'resize_if_width' => 1024, // resize if width is greater than 1024
    ]
];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固