Call to undefined method Illuminate\Database\Eloquent\Builder::load() code example
Example 1: Method Illuminate\Database\Eloquent\Collection
$users = App\Models\User::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
Example 2: Method Illuminate\Database\Eloquent\Collection
use App\Models\User;
$users = $users->diff(User::whereIn('id', [1, 2, 3])->get());