$users = $users->except([1, 2, 3]);
use AppModelsUser;
$users = $users->intersect(User::whereIn('id', [1, 2, 3])->get());
$users->contains(1);
$users->contains(User::find(1));
$users = $users->fresh();
$users = $users->fresh('comments');
use AppModelsUser;
$users = $users->diff(User::whereIn('id', [1, 2, 3])->get());
$users = AppModelsUser::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
$users = User::all();
$user = $users->find(1);
$users = AppModelsUser::all();
$names = $users->reject(function ($user) {
return $user->active === false;
})
->map(function ($user) {
return $user->name;
});
$users->load('comments', 'posts');
$users->load('comments.author');