quanwei
2 days ago 73b874c72ad55eb9eef21c36160ac0de58f0189e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
 
namespace app\common\model\plus\ticket;
 
use app\common\model\BaseModel;
 
/**
 * 模型
 */
class Ticket extends BaseModel
{
    protected $name = 'ticket_upload';
    protected $pk = 'upload_id';
 
 
    /**
     * 关联图片表
     */
    public function image()
    {
        return $this->hasMany('app\\common\\model\\plus\\ticket\\TicketUploadImage', 'upload_id', 'upload_id')->order(['id' => 'asc']);
    }
 
    /**
     * 关联用户表
     */
    public function user()
    {
        return $this->belongsTo('app\\common\\model\\user\\User', 'user_id', 'user_id');
    }
 
 
    /**
     * 详情
     */
    public static function detail($upload_id)
    {
        $model = new static();
        //改变查看状态
        $data["status"]=1;
        $model->where('upload_id', '=', $upload_id)->save($data);
        return $model->with(['image.file','user'])->find($upload_id);
    }
}