| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Constraint\HasTextConstraint;
- $core = Core::getInstance();
- $core->addBreadcrumb("/customers", __("Customers"));
- $nvp = [];
- $request = Request::fromRequest();
- $customer_id = $request->int("customer_id");
- if($customer_id) {
- $nvp["id"] = $customer_id;
- }
- $name = $request->string("name");
- if($name) {
- $nvp["name"] = new HasTextConstraint($name);
- }
- $count = Customer::count($nvp);
- $pagination = new Pagination($count);
- $pagination->setTerms(__("%s customer"), __("%s customers"));
- $customers = Customer::query($nvp, [
- "sort" => "name",
- "offset" => $pagination->getOffset(),
- "limit" => $pagination->getPageSize()
- ]);
- View::include("header");
- View::include("customers", compact("customers", "pagination", "customer_id", "name"));
- View::include("footer");
|