{
return $this->hasOne(AdminGroup::class, ['id' => 'admin_group_id']);
}
+
+ public static function getClosedShiftData($admin_id, $date_start, $date_end) {
+ $timetableFactModels = TimetableFactModel::find()->where([
+ 'admin_id' => $admin_id,
+ 'status' => AdminCheckin::TYPE_END,
+ 'date_start' => date('Y-m-d', strtotime($date_start)),
+ 'date_end' => date('Y-m-d', strtotime($date_end))
+ ])
+ ->andWhere(['<=', 'date_start', date('Y-m-d', strtotime($date_start))])
+ ->andWhere(['>=', 'date_end', date('Y-m-d', strtotime($date_end))])
+ ->all();
+ return $timetableFactModels;
+ }
}
\ No newline at end of file