/** @test */ public function it_checks_if_type_exists() { // Given $type = 'Bob'; $taskType = new TaskType(); $taskType->setType($type); $taskType->setDescription('was here'); $taskType->created_at = Carbon::now(); $taskType->updated_at = Carbon::now(); $taskType->client_id = 1; $taskType->save(); // When $result = TaskType::checkIfExists($type); // Then $this->assertEquals($type, $result->type); }
// get $timeCard->id $timeHoursWorkedCard = TimeCardHoursWorked::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_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();