Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
bf1e25ae
Unverified
Commit
bf1e25ae
authored
Feb 17, 2020
by
Divine
Committed by
GitHub
Feb 17, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into pr_1745
parents
cfe8e920
6cea8aae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
Model.php
src/Jenssegers/Mongodb/Eloquent/Model.php
+1
-1
EmbedsMany.php
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
+23
-12
No files found.
src/Jenssegers/Mongodb/Eloquent/Model.php
View file @
bf1e25ae
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
Jenssegers\Mongodb\Eloquent
;
namespace
Jenssegers\Mongodb\Eloquent
;
use
Carbon
\Carbon
;
use
Illuminate\Support
\Carbon
;
use
DateTime
;
use
DateTime
;
use
Illuminate\Contracts\Queue\QueueableCollection
;
use
Illuminate\Contracts\Queue\QueueableCollection
;
use
Illuminate\Contracts\Queue\QueueableEntity
;
use
Illuminate\Contracts\Queue\QueueableEntity
;
...
...
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
View file @
bf1e25ae
...
@@ -265,25 +265,36 @@ class EmbedsMany extends EmbedsOneOrMany
...
@@ -265,25 +265,36 @@ class EmbedsMany extends EmbedsOneOrMany
}
}
/**
/**
* Get a paginator for the "select" statement.
* @param null $perPage
* @param int $perPage
* @param array $columns
* @return \Illuminate\Pagination\AbstractPaginator
* @param string $pageName
* @param null $page
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
*/
public
function
paginate
(
$perPage
=
null
)
public
function
paginate
(
$perPage
=
null
,
$columns
=
[
'*'
],
$pageName
=
'page'
,
$page
=
null
)
{
{
$page
=
Paginator
::
resolveCurrentPage
(
);
$page
=
$page
?:
Paginator
::
resolveCurrentPage
(
$pageName
);
$perPage
=
$perPage
?:
$this
->
related
->
getPerPage
();
$perPage
=
$perPage
?:
$this
->
related
->
getPerPage
();
$results
=
$this
->
getEmbedded
();
$results
=
$this
->
getEmbedded
();
$results
=
$this
->
toCollection
(
$results
);
$total
=
count
(
$results
);
$total
=
$results
->
count
();
$start
=
(
$page
-
1
)
*
$perPage
;
$start
=
(
$page
-
1
)
*
$perPage
;
$sliced
=
array_slice
(
$results
,
$start
,
$perPage
);
return
new
LengthAwarePaginator
(
$sliced
,
$total
,
$perPage
,
$page
,
[
$sliced
=
$results
->
slice
(
'path'
=>
Paginator
::
resolveCurrentPath
(),
$start
,
]);
$perPage
);
return
new
LengthAwarePaginator
(
$sliced
,
$total
,
$perPage
,
$page
,
[
'path'
=>
Paginator
::
resolveCurrentPath
()
]
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment