I am currently having an issue with laravel where an Illuminate\Database\Eloquent\Collection is always being returned as an object rather than an array - causing problems with my vue components. 

```
Route::get('/users', function (Request $request) {

    $users = User::all();

    $filtered = $users->filter( function ($user) {

            if($user->can('viewAny', 'App\Module')){
                return true;
            }
    });

    return $filtered;

}

```

Anything that goes through the filter refuses to convert to an array either implicitly or explicitly:

```
return User::all(); //Returns Array

return $filtered; //Returns object
return $filtered->toArray(); //Returns object?!

```

What am I doing wrong here? Laravel version is 5.8 and a typical User object in $filtered looks like:

```
3: {
id: 4,
first_name: "Alexandrea",
last_name: "Lind",
email: "russel.oda@example.net",
email_verified_at: "2019-09-25 20:35:03",
created_at: "2019-09-25 20:35:03",
updated_at: "2019-09-25 20:35:03",
is_admin: false,
cycle: 2019,
widening_access_pricing: 0,
can_comment: 1,
can_comment_without_approval: 0,
email_consent: "2019-09-25 20:35:03",
affiliate_id: null,
purchases: [
  {
  id: 28,
  payment_intent_id: "pi_1FoAWUAsJiXFAGV72unvUP6a",
  status: "succeeded",
  user_id: 4,
  product: null,
  module_id: 6,
  created_at: "2019-12-10 15:21:14",
  updated_at: "2019-12-10 15:21:16"
  }
],
completion_records: [
]
},

```