/**
  * Remove the specified RoleUser from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $roleUser = $this->roleUserRepository->find($id);
     if (empty($roleUser)) {
         $this->throwRecordNotFoundException("RoleUser not found", ERROR_CODE_RECORD_NOT_FOUND);
     }
     $roleUser = $this->roleUserRepository->delete($id);
     $meta = array('total' => count($roleUser), 'count' => count($roleUser), 'offset' => 0, 'last_updated' => $this->roleUserRepository->lastUpdated(), 'status' => "RoleUser deleted successfully.", 'error' => 'Success');
     return Response::json(ResponseManager::makeResult($id, $meta));
 }
 /**
  * Remove the specified Category from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         $this->throwRecordNotFoundException("Category not found", ERROR_CODE_RECORD_NOT_FOUND);
     }
     $category->delete();
     return Response::json(ResponseManager::makeResult($id, "Category deleted successfully."));
 }
 /**
  * Display a listing of the BarcodeProcess.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function statistic(Request $request)
 {
     $input = $request->all();
     $query = BarcodeProcess::select(\DB::raw('count(*) as total_transactions, shelf_id, created_at'))->groupBy('shelf_id');
     /**
      * Filter
      */
     $this->barcodeProcessRepository->filter($input, $query);
     /**
      * Get count
      */
     $total = $query->count();
     /**
      * Pagination
      */
     $this->barcodeProcessRepository->pagination($input, $query);
     $barcodeProcesses = $query->get();
     $meta = array('total' => $total, 'count' => count($barcodeProcesses), 'offset' => isset($input['offset']) ? (int) $input['offset'] : 0, 'last_updated' => $this->barcodeProcessRepository->lastUpdated(), 'status' => "BarcodeProcesses retrieved successfully.", 'error' => 'Success');
     return Response::json(ResponseManager::makeResult($barcodeProcesses->toArray(), $meta));
 }
 /**
  * Remove the specified Note from storage.
  *
  * @param  int $id
  *
  * @return Response
  * @throws RecordNotFoundException
  */
 public function destroy($id)
 {
     $note = $this->noteRepository->findNoteById($id);
     if (empty($note)) {
         throw new RecordNotFoundException("Note not found", ERROR_CODE_RECORD_NOT_FOUND);
     }
     $note->delete();
     return Response::json(ResponseManager::makeResult($id, "Note deleted successfully."));
 }
 public function throwRecordNotFoundException($message, $code = 0)
 {
     throw new HttpResponseException(Response::json(ResponseManager::makeError($code, $message)));
 }