Files
useds/app/common/model/User.php
T
2026-03-10 14:25:17 +08:00

56 lines
1.1 KiB
PHP

<?php
namespace app\common\model;
use support\Model;
class User extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'union_id', 'app_id', 'name', 'name_en', 'avatar', 'phone', 'email', 'whatsapp', 'social', 'social_code', 'status', 'role'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
// 账号查询的作用域
public function scopeByAccount($query, $account)
{
return $query->Where('phone', $account)
->orWhere('email', $account);
}
}