kharanenka/oc-data-file-model
最新稳定版本:1.1.0
Composer 安装命令:
composer require kharanenka/oc-data-file-model
包简介
Trait helps to get attached to the model file data
README 文档
README
Trait helps to get attached to the model file data. For 'attache one' relation returns data array with fields:
- (string) full_path
- (string) path
- (string) title
- (string) alt
For 'attache many' relation returns array with files data.
#Installation
Require this package in your composer.json and update composer.
"kharanenka/oc-data-file-model": "1.*"
#Uses
class MyModel extends Model { use DataFileModel; public $attachOne = ['preview_image' => 'System\Models\File']; public $attachMany = ['images' => 'System\Models\File']; } $obModel = MyModel::first(); $arFileData = $obModel->getFileData('preview_image'); $arFileList = $obModel->getFileListData('images');
Result:
$arFileData = [ 'full_path' => '...', 'path' => '...', 'title' => '...', 'alt' => '...', ]; $arFileList = [ [ 'full_path' => '...', 'path' => '...', 'title' => '...', 'alt' => '...', ],[ 'full_path' => '...', 'path' => '...', 'title' => '...', 'alt' => '...', ], ];
统计信息
- 总下载量: 37.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-11-12