/** * @name all * @description get all items * @return mixed */ private function all() { $items = new Items(); if ($itemsData = $items->all()) { return $this->response($itemsData, ''); } return $this->response('', "Could not get the items", true); }
<?php error_reporting(E_ALL); ini_set('display_errors', 1); // include the items class include_once '../classes/concertClass.php'; // response $response = array('error' => true, 'message' => ''); $items = new Items(); if ($allItems = $items->all()) { $response['error'] = false; $response['data'] = $allItems; } // response echo json_encode($response);
<?php /** * @name table.php * @description prints all the inventary items inside a table */ require_once 'src/classes/ItemsClass.php'; // instace of the items $items = new Items(); // get all items on the database $myItems = $items->all(); // print the table echo '<table class="table"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Created</th> <th>Updated</th> <th>Actions</th> </tr> </thead> <tbody> '; foreach ($myItems as $key => $item) { echo '<tr id="' . $item['id'] . '"> <td> ' . $item['id'] . ' </td> <td>