laravel returns Illuminate\Database\Eloquent\Collection Object code example
Example 1: Method Illuminate\Database\Eloquent\Collection
$users = App\Models\User::all();
$names = $users->reject(function ($user) {
return $user->active === false;
})
->map(function ($user) {
return $user->name;
});
Example 2: Method Illuminate\Database\Eloquent\Collection
$users = $users->except([1, 2, 3]);