| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?phpnamespace app\model;use support\Model;class MedicalDept extends Model{    protected $table = 'medical_dept';    protected $primaryKey = 'dept_id';    protected $dateFormat = 'U';    public const CREATED_AT = 'dept_addTime';    public const UPDATED_AT = 'dept_updateTime';    public function getDeptAddTimeAttribute($value){        return date('Y-m-d H:i:s',$value);    }    /**     * @Desc 根据主键获取数据     * @Author Gorden     * @Date 2024/3/1 15:59     *     * @param $id     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null     */    public function getByPrimaryKey($id)    {        return self::where('dept_id', $id)->first();    }    /**     * 根据path获取指定科室的所有下级     */    public function getAllSubDept($path)    {        return self::where('dept_path', 'like', $path . '%')->get()->toArray();    }}
 |