コード例 #1
0
 /**
  * @param $ttvAttributes
  */
 public function create($ttvAttributes)
 {
     $newTaskType = new TaskType();
     $newTaskType->setType($ttvAttributes['type']);
     $newTaskType->setDescription($ttvAttributes['description']);
     $newTaskType->setClientId($ttvAttributes['client_id']);
     $newTaskType->save();
 }
コード例 #2
0
ファイル: routes.php プロジェクト: RichJones22/TimeTrax
        $task->task_type_id = $taskType->id;
        $task->time_card_hours_worked_id = $timeHoursWorkedCard->id;
        $task->save();
    }
});
Route::get('add_taskType_data', function () {
    $type = 'Lunch';
    $description = 'Lunch break';
    if (is_null($taskType = TaskType::checkIfExists($type))) {
        // get $client->id
        $client = Client::where('name', '=', 'Kendra Scott')->first();
        $taskType = new TaskType();
        $taskType->type = $type;
        $taskType->description = $description;
        $taskType->client_id = $client->id;
        $taskType->save();
    }
});
Route::get('add_timeCard_data', function () {
    $date = '2015-11-09';
    // get $work->id
    $work = Work::where('work_type_description', '=', 'The catalog view is performing too slowly.')->first();
    // get $timeCardFormat->id
    $timeCardFormat = TimeCardFormat::where('description', '=', 'Day of week starts on SAT and ends on SUN')->first();
    $timeCard = new TimeCard();
    $timeCard->work_id = $work->id;
    $timeCard->time_card_format_id = $timeCardFormat->id;
    if (!is_null($timeCard = TimeCard::checkIfExists($timeCard))) {
        $timeCardHoursWorked = new TimeCardHoursWorked();
        $timeCardHoursWorked->work_id = $work->id;
        $timeCardHoursWorked->date_worked = $date;
コード例 #3
0
ファイル: TaskTypeTest.php プロジェクト: RichJones22/TimeTrax
 /**
  * updateRec() tests
  *  - attribute description changed.
  *
  * @test
  */
 public function POS_it_checks_updateRec_att_description_changed()
 {
     // create the record to check
     $description = 'was here';
     $taskType = new TaskType();
     $taskType->setType('Bob');
     $taskType->setDescription($description);
     $taskType->created_at = Carbon::now();
     $taskType->updated_at = Carbon::now();
     $taskType->client_id = 1;
     $taskType->save();
     // create the changed record
     $changeDescription = 'sorry bob is no longer here';
     $stdClass = new \stdClass();
     $stdClass->id = $taskType->id;
     $stdClass->type = $taskType->getType();
     $stdClass->desc = $changeDescription;
     $stdClass->client_id = $taskType->client_id;
     $taskType->updateRec($stdClass);
     $result = $taskType::where('id', $taskType->getId())->first();
     $this->assertEquals($result->getDescription(), $changeDescription);
 }