2017 © Pedro Peláez
 

library oc-data-file-model

Trait helps to get attached to the model file data

image

kharanenka/oc-data-file-model

Trait helps to get attached to the model file data

  • Wednesday, August 30, 2017
  • by Andrey Kharanenka
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 28 % Grown

The README.md

Trait DataFileModel

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, (*1)

For 'attache many' relation returns array with files data., (*2)

Installation

Require this package in your composer.json and update composer., (*3)


"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:, (*4)

$arFileData = [
    'full_path' => '...',
    'path'      => '...',
    'title'     => '...',
    'alt'       => '...',
];

$arFileList = [
    [
        'full_path' => '...',
        'path'      => '...',
        'title'     => '...',
        'alt'       => '...',
    ],[
        'full_path' => '...',
        'path'      => '...',
        'title'     => '...',
        'alt'       => '...',
    ],
];

The Versions

30/08 2017

dev-master

9999999-dev

Trait helps to get attached to the model file data

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

by Avatar Andrey Kharanenka

file php model octobercms attache

27/08 2017

1.1.0

1.1.0.0

Trait helps to get attached to the model file data

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

by Avatar Andrey Kharanenka

file php model octobercms attache

12/11 2016

1.0.0

1.0.0.0

Trait helps to get attached to the model file data

  Sources   Download

GPL-3.0

The Requires

  • php >=5.6

 

by Avatar Andrey Kharanenka

file php model octobercms attache