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
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-14