hospital-applets-api/app/Model/ArticleScienceSource.php

58 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Carbon\Carbon;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $source_id 主键id
* @property string $source_name 来源名称
* @property string $source_image 来源图片
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 修改时间
*/
class ArticleScienceSource extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'article_science_source';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['source_id', 'source_name', 'source_image', 'created_at', 'updated_at'];
protected string $primaryKey = "source_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);
}
}