notHavingLike() adds HAVING NOT LIKE conditions.
Purpose
notHavingLike() adds HAVING NOT LIKE conditions. It lets a controller customize Aksara Core behavior while keeping the request inside the built-in CRUD, rendering, permission, validation, and response pipeline.
When to Use
Use it when a controller needs to shape the generated dataset before calling render() without creating a separate custom query flow.
Reference
notHavingLike(string|array $field = [], mixed $match = '', string $side = 'both', bool $escape = true, bool $caseInsensitive = false)
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
$field | string|array | No | [] | Field name, field list, or associative field configuration. |
$match | mixed | No | '' | Value matched by LIKE/HAVING LIKE. |
$side | string | No | 'both' | Wildcard side: before, after, both, or none. |
$escape | bool | No | true | Whether the database layer should escape identifiers and values. |
$caseInsensitive | bool | No | false | Use case-insensitive matching when supported. |
Return Value
static
Returns the current controller instance so it can be chained with other Core methods.
Behavior
notHavingLike() records a query instruction on the controller. Core applies that instruction when render() compiles the final query. It does not execute a database query by itself.
Basic Usage
$this->notHavingLike('customer_name', 'Test');
return $this->render('orders');
Advanced Usage
$this->select('orders.order_id, orders.order_number, customers.customer_name')
->join('customers', 'customers.customer_id = orders.customer_id', 'left')
->where('orders.deleted_at', null)
->orderBy('orders.created_at', 'DESC')
->limit(25);
return $this->render('orders');
Complete Example
namespace Modules\Orders\Controllers;
use Aksara\Laboratory\Core;
class Orders extends Core
{
public function index()
{
$this->setTitle(phrase('Orders'))
->notHavingLike('customer_name', 'Test');
return $this->render('orders');
}
}
Result
The final generated query includes this instruction before rows are serialized and rendered. API responses use the same prepared query.
Notes
- This method is chainable and returns the current controller instance.
- Call this before
render()so the query instruction is available during query compilation. - Leave
$escapeenabled unless the expression has already been validated and intentionally needs raw SQL behavior.
Common Mistakes
- Calling the method after
render(), because the query has already been compiled. - Disabling escaping for untrusted request input.
