Files
hyperf_service/app/Model/Cycle.php
2025-01-08 11:28:08 +08:00

55 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property string $dates
* @property string $create_time
*/
class Cycle extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'cycle';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer'];
const string CREATED_AT = 'create_time';
const null UPDATED_AT = null;
/**
* @param string $date
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getInfoByDate(string $date): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('dates',$date)->first();
}
/**
* @param int $id
* @return \Hyperf\Database\Model\Model|Builder|null
*/
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('id',$id)->first();
}
}