Пример #1
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();
        $task = new Task();
        $task->start_time = $startTime;
        $task->end_time = $endTime;
        $task->hours_worked = $hoursWorked;
        $task->notes = $notes;
        $task->task_type_id = $taskType->id;
        $task->time_card_id = $timeCard->id;
        try {
            $task->save();
        } catch (QueryException $e) {
            if ($e->getCode() == appGlobals::TBL_TASK_START_TIME_GT_END_TIME) {