September 2018
Beginner to intermediate
192 pages
4h 37m
English
The Lookup class is used by json.php to perform purchases lookups by date in the initial view. When adding a new purchase, the same class provides responses to requests that were originated by the jQuery autocomplete widget for customer names and product titles:
namespace Application; use Throwable; use MongoDB\BSON\Regex; class Lookup extends Base {
The first method returns an array of customer names. The $term is provided by the jQuery autocompete widget when the user starts typing:
public function getListOfCustomers($term) { $filter = NULL; if ($term) { $regex = new Regex($term, 'i'); $filter = ['name' => $regex]; } $options = [ 'sort' => ['name' => 1], 'projection' => ['name' => 1] ]; $result = []; try { $cursor = ...Read now
Unlock full access