Example #1
0
 public function deleteNote($noteId)
 {
     $date = date('Y-m-d H:i:s');
     $noteName = Note::where('noteId', $noteId)->first()->noteName . (string) $date;
     if (Note::where('noteId', $noteId)->update(array('noteName' => $noteName, 'status' => -1, 'updated_at' => $date))) {
         // Update lasted_update of user table
         User::updateLastest($userId, $date);
         return array('status' => 200, 'lastedUpdate' => $date);
     } else {
         return array('status' => 304);
     }
 }
Example #2
0
 public function deleteCategory($userId, $categoryId)
 {
     $date = date('Y-m-d H:i:s');
     $cate = Category::where('categoryId', $categoryId)->where('userId', $userId)->first();
     $categoryName = $cate->categoryName . (string) $date;
     if (Category::where('categoryId', $categoryId)->where('userId', $userId)->update(array('categoryName' => $categoryName, 'status' => -1, 'updated_at' => $date))) {
         // Delete all note in cate
         Note::where('cateId', $categoryId)->update(array('status' => -1, 'updated_at' => $date));
         // Update lasted_update of user table
         User::updateLastest($userId, $date);
         return array('status' => 200, 'lastedUpdate' => $date);
     } else {
         return array('status' => 304);
     }
 }