47 lines
843 B
PHP
47 lines
843 B
PHP
<?php namespace Tps\Tps\Models;
|
|
|
|
use Model;
|
|
|
|
/**
|
|
* Model
|
|
*/
|
|
class Media extends Model
|
|
{
|
|
use \October\Rain\Database\Traits\Validation;
|
|
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
|
|
|
|
public $hasMany = [
|
|
'media_view' => [
|
|
'Tps\Tps\Models\MediaView',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* @var string The database table used by the model.
|
|
*/
|
|
public $table = 'tps_tps_media';
|
|
|
|
public $jsonable = ['media_file'];
|
|
|
|
public $translatable = [
|
|
'name',
|
|
'subtitle'
|
|
];
|
|
|
|
public function scopeGetVideo($query)
|
|
{
|
|
return $query->where('type', 'video');
|
|
}
|
|
|
|
public function scopeGetPhoto($query)
|
|
{
|
|
return $query->where('type', 'photo');
|
|
}
|
|
|
|
/**
|
|
* @var array Validation rules
|
|
*/
|
|
public $rules = [
|
|
];
|
|
}
|