50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php namespace Aweos\Resizer\Models;
|
|
|
|
use Model;
|
|
|
|
/**
|
|
* Setting Model
|
|
*/
|
|
class SourceFile extends Model
|
|
{
|
|
use \October\Rain\Database\Traits\Sluggable;
|
|
|
|
protected $slugs = ['slug' => 'basename'];
|
|
|
|
/**
|
|
* @var string The database table used by the model.
|
|
*/
|
|
public $table = 'responsive_source_files';
|
|
|
|
/**
|
|
* @var array Guarded fields
|
|
*/
|
|
protected $guarded = ['*'];
|
|
|
|
/**
|
|
* @var array Fillable fields
|
|
*/
|
|
protected $fillable = ['id', 'basename', 'extension', 'tags', 'slug', 'aspect_ratio'];
|
|
|
|
public $jsonable = ['tags', 'aspect_ratio'];
|
|
|
|
/**
|
|
* @var array Relations
|
|
*/
|
|
public $hasOne = [];
|
|
public $hasMany = [
|
|
'attachments' => [Attachment::class, 'key' => 'file_id']
|
|
];
|
|
public $belongsTo = [];
|
|
public $belongsToMany = [];
|
|
public $morphTo = [];
|
|
public $morphOne = [];
|
|
public $morphMany = [];
|
|
public $attachOne = [];
|
|
public $attachMany = [];
|
|
|
|
public function getPathAttribute() {
|
|
return 'source/'.$this->slug.'.'.$this->extension;
|
|
}
|
|
}
|