Should not be wrapped in a WHERE
$filter->leftJoin('customers', function($join) {
$join->on('booking.customer_id', '=', 'customers.id')
->where('customers.first_name', 'like', "%{$this->input}%");
})->toSql();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
$filter->where(function ($query) {
$query->leftjoin('customers AS c', function($join){
$join->on('booking.customer_id', '=', 'c.id')
->where('c.first_name', 'like', "%{$this->input}%");
})->dump();
}, 'Customer has booking')->placeholder('search by first name Like');
Dump data :
"select * from `booking` left join `customers` as `c` on `booking`.`customer_id` = `c`.`id` and `c`.`first_name` like ?"
I tried to run on MySQL phpMyAdmin, it works, but the result on website response the same
Please or to participate in this conversation.