hospital-applets-api/app/Model/BasicNation.php
2023-03-23 14:24:13 +08:00

56 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $nation_id 主键id
* @property string $nation_name 民族名称
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class BasicNation extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'basic_nation';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['nation_id', 'nation_name', 'created_at', 'updated_at'];
protected string $primaryKey = "nation_id";
/**
* 获取信息-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getOne(array $params, array $fields = ['*'],): object|null
{
return self::where($params)->first($fields);
}
/**
* 获取信息-多条
* @param array $params
* @param array $fields
* @return Collection|array
*/
public static function getList(array $params, array $fields = ['*']): Collection|array
{
return self::where($params)->get($fields);
}
}