芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/ProjectTimeLogBreak.php
'datetime', 'end_time' => 'datetime', ]; public function timelog(): BelongsTo { return $this->belongsTo(ProjectTimeLog::class, 'project_time_log_id'); } public static function projectBreakMinutes($projectID) { return ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->where('project_time_logs.project_id', $projectID) ->sum('project_time_log_breaks.total_minutes'); } public static function taskBreakMinutes($taskID) { return ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->where('project_time_logs.task_id', $taskID) ->whereNotNull('project_time_logs.end_time') ->sum('project_time_log_breaks.total_minutes'); } public static function userBreakMinutes($userID) { return ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->where('project_time_logs.user_id', $userID) ->sum('project_time_log_breaks.total_minutes'); } public static function milestoneBreakMinutes($milestoneID) { return ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->join('project_milestones', 'project_milestones.project_id', '=', 'project_time_logs.project_id') ->where('project_milestones.id', $milestoneID) ->sum('project_time_log_breaks.total_minutes'); } public static function dateWiseTimelogBreak($date, $userID = null) { $timelogs = ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->whereDate('project_time_log_breaks.start_time', $date) ->whereNotNull('project_time_logs.end_time') ->select('project_time_log_breaks.*'); if (!is_null($userID)) { $timelogs = $timelogs->where('project_time_logs.user_id', $userID); } return $timelogs = $timelogs->get(); } public static function weekWiseTimelogBreak($startDate, $endDate, $userID = null) { $timelogs = ProjectTimeLogBreak::join('project_time_logs', 'project_time_log_breaks.project_time_log_id', '=', 'project_time_logs.id') ->whereBetween(DB::raw('DATE(project_time_log_breaks.`start_time`)'), [$startDate, $endDate]) ->whereNotNull('project_time_logs.end_time') ->select('project_time_log_breaks.*'); if (!is_null($userID)) { $timelogs = $timelogs->where('project_time_logs.user_id', $userID); } return $timelogs = $timelogs->sum('project_time_log_breaks.total_minutes'); } }