Files
hyperf_service/app/Model/Chef.php
LAPTOP-7SGDREK0\shiweijun 804d65b725 feat:chef
2025-01-09 14:58:50 +08:00

60 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use App\Constants\Admin\UserCode;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property int $user_id
* @property string $profile
* @property string $specialties
* @property int $is_del
* @property string $create_time
* @property string $update_time
*/
class Chef extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'chef';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'is_del' => 'integer'];
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';
/**
* @param int $id
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('id', $id)->first();
}
/**
* @param int $userId
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getInfoByUserId(int $userId): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('is_del',UserCode::IS_NO_DEL)->where('user_id', $userId)->first();
}
}