After inspecting the returned $builder i noticed that calling withTrashed() somehow only removed the scope SoftDeletingScope but not the "where deleted_at = null". So i ended up looping through all wheres of the builder and removing the where clause:
public function apply(Builder $builder, Model $model) {
// remove global scope
$builder = $builder->withTrashed();
// remove "where deleted_at = null"
$wheres = $builder->getQuery()->wheres;
foreach($wheres as $key => $data) {
if($data['column'] == $model->getTable() . '.deleted_at' && $data['type'] == "Null") {
unset($builder->getQuery()->wheres[$key]);
}
}
return $builder;er;
}
This seems like a really dirty solution and I still have absolutely no idea why calling withTrashed() does not remove the where clause. So if someone knows a better solution or why this didnt work as expected, feel free to post your answer :P