$sql = Author::filter(
[
[
'target' => 'age',
'type' => '$eq',
'value' => 20,
],
],
Filter::only(
Filter::field(
Target::alias('age', 'author_profiles.age'),
[FilterType::EQUAL]
),
)
)->join('author_profiles', function (JoinClause $join): void {
$join->on('authors.id', '=', 'author_profiles.author_id');
})->toRawSql();