job_name = $name; $this->job_state = 'Starting'; $this->system_time = Carbon::now(); } public function SetStartStatus() { //Add an entry into the jobs table $job = new ScheduleJob; $job->job_name = $this->job_name; $job->job_state = $this->job_state; $job->system_time = $this->system_time; $job->save(); } public function SetStopStatus() { //Mark the job as finished ScheduleJob::where([ 'system_time' => $this->system_time, 'job_name' => $this->job_name, ])->update([ 'job_state' => 'Finished', ]); } public function CleanJobStatusTable() { //Delete old jobs ScheduleJob::where(['system_time', '<', Carbon::now()->subMonths(3)])->delete(); } } ?>