public static function checkIfExists($text) { $timeCardFormat = TimeCardFormat::where('description', '=', $text)->first(); if (!is_null($timeCardFormat)) { appGlobals::existsMessage(appGlobals::getTimeCardFormatTableName(), $timeCardFormat->description, $timeCardFormat->id); } return $timeCardFormat; }
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); // register the ProjectObserver class. Client::observe(new ClientObserver()); // register the ProjectObserver class. Project::observe(new ProjectObserver()); // register the WorkTypeObserver class. WorkType::observe(new WorkTypeObserver()); // register the TimeCardFormatObserver class. TimeCardFormat::observe(new TimeCardFormatObserver()); // register the WorkObserver class. Work::observe(new WorkObserver()); // register the TimeCardObserver class. TimeCard::observe(new TimeCardObserver()); // register the TimeCardHoursWorkedObserver class. TimeCardHoursWorked::observe(new TimeCardHoursWorkedObserver()); // register the TaskTypeObserver class. TaskType::observe(new TaskTypeObserver()); // register the TaskObserver class. Task::observe(new TaskObserver()); }
} } }); /** * prototyping... */ Route::get('play', function () { $myArray['SUN'] = 0.0; $myArray['MON'] = 0.0; $myArray['TUE'] = 5.0; $myArray['WED'] = 0.0; $myArray['THU'] = 3.0; $myArray['FRI'] = 2.0; $myArray['SAT'] = 10.0; $description = 'Day of week starts on SAT and ends on SUN'; $timeCardFormat = TimeCardFormat::where('description', '=', $description)->first(); for ($j = 0; $j < appGlobals::DAYS_IN_WEEK_NUM; $j++) { $pos = $timeCardFormat->{"dow_0" . $j}; echo "For {$pos} the hours worked are: " . $myArray[$pos] . "<br>"; } }); Route::get('task_fail', function () { $startTime = '17:00:00'; $endTime = '12:00:00'; $hoursWorked = 5.0; $notes = "error testing"; if (is_null($task = Task::checkIfExists($startTime))) { // get $taskType->id $taskType = TaskType::where('type', '=', 'Code')->first(); // get $timeCard->id $timeCard = TimeCard::where('date_worked', '=', '2015-11-12')->first();