Visit.php 832 字节
<?php

namespace App\Models\Visit;


use App\Models\Base;

/**
 * Class Visit
 * @package App\Models
 * @author zbj
 * @date 2023/5/22
 */
class Visit extends Base
{

    //设置关联表名
    protected $table = 'gl_customer_visit';
    //连接数据库
    protected $connection = 'custom_mysql';
    protected $appends = ['device_text'];

    public static function deviceMap(){
        return [
            1 => 'PC',
            2 => '移动端'
        ];
    }

    /**
     * @return string
     * @author zbj
     * @date 2023/5/22
     */
    public function getDeviceTextAttribute(){
        return self::deviceMap()[$this->device_port] ?? '';
    }

    /**
     * @author zbj
     * @date 2023/9/11
     */
    public function yesterdayIpCount(){
        return self::deviceMap()[$this->device_port] ?? '';
    }

}