<?php
declare(strict_types=1);

namespace App\Model;

use Hyperf\DbConnection\Model\Model;

class DevicesModel extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'devices';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [];

    public function devicephone()
    {
        $data = self::where(['dtype' => 13, 'power_supply' => 2, 'status' => 9])
            ->join('users', 'devices.username', '=', 'users.username')
            ->select('users.phone', 'devices.devicenum')
            ->get();
        if ($data) {
            return $data;
        } else {
            return '';
        }
    }

}