format('Y-m-d H:i:s'); } /** * @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(); } }