You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
548 B
28 lines
548 B
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class PageServe
|
|
{
|
|
public function __construct(Request $request)
|
|
{
|
|
$this->request = $request;
|
|
}
|
|
|
|
public function getPageParameters($limit = 10)
|
|
{
|
|
$page = $this->request->input('page', 1);
|
|
$limit = $this->request->input('limit', $limit);
|
|
$offset = ($page - 1) * $limit;
|
|
|
|
return [$limit, $offset, $page];
|
|
}
|
|
|
|
public function input($key, $default = null)
|
|
{
|
|
return $this->request->input($key, $default);
|
|
}
|
|
}
|