<?php
|
|
namespace app\common\model\branch;
|
|
use app\common\model\BaseModel;
|
/**
|
* 商品图片模型
|
*/
|
class ActivityFile extends BaseModel
|
{
|
protected $name = 'branch_activity_file';
|
protected $updateTime = false;
|
|
/**
|
* 关联文件库
|
*/
|
public function file()
|
{
|
return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'file_id', 'file_id')
|
->bind(['file_path', 'file_name', 'file_url', 'is_original']);
|
}
|
|
/**
|
* 关联文件库原图
|
*/
|
public function original()
|
{
|
return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'file_id', 'file_id')
|
->bind(['file_path', 'original_path', 'is_original']);
|
}
|
|
/**
|
* 文件详情
|
*/
|
public static function detail($where, $with = [])
|
{
|
if (is_array($where)) {
|
return (new static())->with($with)->where($where)->find();
|
} else {
|
return (new static())->with($with)->where('id', '=', $where)->find();
|
}
|
}
|
|
}
|