When you have a group of orwhere's in combination with normal where's, you should put them in their own closure so the query builder knows these need to be seen together apart from the other where's.
$filtertext = $request->filter;
$data = Activity::select('activity_log.*', 'users.first_name', 'users.last_name', 'users.email')
->join('users', 'users.id', '=', 'activity_log.causer_id')
->where('subject_id', '=', $id)
->where('subject_type', '=', 'App\Models\Node')
->where(function ($query) use ($filtertext) {
$query
->orWhere('first_name', 'like', '%' . $filtertext . '%')
->orWhere('last_name', 'like', '%' . $filtertext . '%')
->orWhere('email', 'like', '%' . $filtertext . '%');
})
->with([
'subject' => function ($q) {
$q->whereNull('deleted_at');
}
])
->orderBy('created_at', 'desc')
->paginate(12);