/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     try {
         $admin = \Auth::User();
         if (!$admin) {
             return $this->failResponse('admin not logged in');
         }
         $invoiceItemObj = new InvoiceItem();
         $query = $invoiceItemObj->buildQuery();
         $total = $query->count();
         $paginate = 1;
         $meta = array();
         if ($paginate == 0) {
             $query = $query->get();
             $senddata = $query;
         } else {
             $limit = 10;
             $offset = 0;
             if (isset($_GET["limit"])) {
                 $limit = $_GET["limit"];
             }
             if (isset($_GET["offset"])) {
                 $offset = $_GET["offset"];
             }
             $perpage = $limit;
             $query = $query->paginate($perpage);
             $data = $query->toArray();
             $senddata = $data['data'];
             $meta["total"] = $total;
             $meta["offset"] = $offset;
             $meta["limit"] = $limit;
         }
         return $this->successResponse($senddata, $meta);
     } catch (\Exception $e) {
         Log::error("error in customer controller");
         return $this->failResponse($e->getMessage());
     }
 }