??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/pyan.co.uk/wp-content/plugins/latepoint/lib/abilities/customers/search-customers.php
⬅ Kembali
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class LatePointAbilitySearchCustomers extends LatePointAbstractCustomerAbility {
protected function configure(): void {
$this->id = 'latepoint/search-customers';
$this->label = __( 'Search customers', 'latepoint' );
$this->description = __( 'Searches customers by name, email, or phone — optimised for autocomplete.', 'latepoint' );
$this->permission = 'customer__view';
$this->read_only = true;
}
public function get_input_schema(): array {
return [
'type' => 'object',
'properties' => [
'query' => [
'type' => 'string',
'description' => __( 'Search term.', 'latepoint' ),
],
'limit' => [
'type' => 'integer',
'default' => 10,
'minimum' => 1,
'maximum' => 50,
],
],
'required' => [ 'query' ],
];
}
public function get_output_schema(): array {
return [
'type' => 'object',
'properties' => [
'customers' => [
'type' => 'array',
'items' => $this->customer_output_schema(),
],
],
];
}
public function execute( array $args ) {
$search = sanitize_text_field( $args['query'] );
$limit = min( 50, max( 1, (int) ( $args['limit'] ?? 10 ) ) );
$s = '%' . $search . '%';
$customers = ( new OsCustomerModel() )
->where(
[
'OR' => [
'first_name LIKE' => $s,
'last_name LIKE' => $s,
'email LIKE' => $s,
'phone LIKE' => $s,
],
]
)
->order_by( 'last_name ASC' )
->set_limit( $limit )
->get_results_as_models();
return [
'customers' => array_map( [ $this, 'serialize_customer' ], $customers ),
];
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 abstract-customer-ability.php
php
1.4 KB
2026-03-10 11:15
🐘 connect-customer-to-wp-user.php
php
2.4 KB
2026-04-24 10:27
🐘 create-customer.php
php
2.2 KB
2026-03-10 11:15
🐘 delete-customer.php
php
1.5 KB
2026-03-10 11:15
🐘 get-customer-bookings.php
php
2.8 KB
2026-03-10 11:15
🐘 get-customer-by-email.php
php
1.2 KB
2026-03-10 11:15
🐘 get-customer-orders.php
php
2.2 KB
2026-03-10 11:15
🐘 get-customer.php
php
1.1 KB
2026-03-10 11:15
🐘 get-total-customers-count.php
php
866 B
2026-03-10 11:15
🐘 list-customers.php
php
2.2 KB
2026-03-10 11:15
🐘 search-customers.php
php
1.6 KB
2026-03-10 11:15
🐘 update-customer.php
php
2.2 KB
2026-03-10 11:15