The paginate()
method is not available directly on the Illuminate\Database\Eloquent\Collection class. Instead, it is a method provided by the query builder (Illuminate\Database\Eloquent\Builder) or the model itself (Illuminate\Database\Eloquent\Model).
To merge two paginated collections and paginate the result, you can take a different approach:
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
$collection1 = Model1::paginate($perPage);
$collection2 = Model2::paginate($perPage);