Esempio n. 1
0
 public function store($task_id, Request $request)
 {
     $note = new Note();
     $note->task_id = $task_id;
     $note->text = $request->input('note_text');
     $note->save();
     return redirect()->route('tasks.show', ['id' => $task_id])->with('info', 'The Note was saved!');
 }
Esempio n. 2
0
 public function testUserCanDeleteANote()
 {
     $additional_note = factory(Note::class)->create(['task_id' => $this->task->id]);
     $notecount = Note::where('task_id', $this->task->id)->count();
     $this->assertEquals($notecount, Note::where('task_id', $this->task->id)->count());
     $this->actingAs($this->user)->makeRequest('DELETE', "/tasks/{$this->task->id}/notes/{$additional_note->id}");
     $this->assertEquals($notecount - 1, Note::where('task_id', $this->task->id)->count());
 }