access paginator object attribute in laravel code example

Example 1: access paginator object attribute in laravel

$paginator = tap($this->items()->where('position', '=', null)->paginate(15),function($paginatedInstance){
    return $paginatedInstance->getCollection()->transform(function ($value) {
        return $value;
    });
});

Example 2: access paginator object attribute in laravel

$paginator = $this->items()->where('position', '=', null)->paginate(15);
$paginator->getCollection()->transform(function ($value) {
    // Your code here
    return $value;
});

Tags:

Php Example