/** * Jobs started in the current shift * @return mixed */ public function currentShiftJobsStarted() { $jobsStartedIds = DB::table(LaminatingLogSheet::table())->select('job_cards_id')->groupBy('job_cards_id')->havingRaw('min(created_at) >= \'' . $this->current_shift->starting_time . '\'')->havingRaw('min(created_at) <= \'' . $this->current_shift->ending_time . '\'')->pluck('job_id_fk'); return JobCard::find($jobsStartedIds); }