Ejemplo n.º 1
0
 /**
  * @param $clientId
  * @param null $timeCardId
  *
  * @return mixed
  */
 public function show($clientId, $timeCardId = null)
 {
     // set appGlobals.
     $this->setGlobals($timeCardId);
     // get all task for a specific time_card.date.
     /* @noinspection PhpUndefinedMethodInspection */
     $taskTypes = TaskType::where('client_id', $clientId)->get();
     // check if $timeCardHoursWorkedId exists, if not return 404 message.
     if (count($taskTypes) == 0) {
         abort(404, 'Your Task Type ID does not exist.');
     }
     // pass the data to the view.
     return view('pages.userTaskTypeView')->with('taskTypes', $taskTypes)->with('clientId', $clientId);
 }
Ejemplo n.º 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) {
                appGlobals::reportError($e, __FILE__, __LINE__);
            }