Exemplo n.º 1
0
 public function saveNote($data)
 {
     if (isset($data)) {
         $data['noteDate'] = $this->utilityService->parseToMysqlDate($data['noteDate']);
         $userName = Auth::user()->username;
         $note = new Note(array("noteDate" => $data["noteDate"], "noteContact" => $data["noteContact"], "noteContactType" => $data["noteContactType"], "noteContent" => $data["noteContent"], "rj_case_id" => $data["id"], "userName" => $userName));
         $note->save();
         $savedNote = $note->find($note->id);
         $responseData = array('note' => $savedNote);
         return response()->json($responseData);
     }
 }
Exemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data = $request->all();
     $noteFields = Schema::connection('mysql')->getColumnListing('notes');
     if (isset($data)) {
         $note = Note::find($id);
         if (in_array($data['name'], $noteFields)) {
             if ($this->utilityService->isDateField($data['name'])) {
                 $data['value'] = $this->utilityService->parseToMysqlDate($data['value']);
             }
             $note[$data['name']] = $data['value'];
         }
         $note->save();
     }
     return response()->json(array('note' => $note->toArray()));
 }