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(); } } }