As yii2 REST to make selection start limit?

Good day how can I implement in Yii2 sample, client sends the start and limit.
July 8th 19 at 15:34
2 answers
July 8th 19 at 15:36
Solution
public function actionIndex() {

 $query = Users::find();
 $start = \Yii::$app->request->get('start');
 $limit = \Yii::$app->request->get('length');


 $pagination = new Pagination([
 'totalCount' => $query->count(),
]);

 $users['data'] = $query->offset($start)
->limit($limit)
->all();

 $users['recordsTotal'] = $pagination->totalCount;
 $users['recordsFiltered'] = $pagination->totalCount;

 return $users; 
 }

The output was, pokracujte.
July 8th 19 at 15:38
sample where? in ActiveQuery?
if Yes then
Model::find()->offset($start)->limit($limit)
Describe in detail at least where to dig. Created REST (ActiveController) something like this public function actionIndex()
{
$query = Users::find();

$pagination = new Pagination([
'defaultPageSize' => 10,
'totalCount' => $query->count(),
'pageSizeParam' => 'start',
]);

$users['data'] = $query->offset($pagination->offset)
->limit($pagination->limit)
->all();

return $users;
}

How do I catch the parameters passed to the GET request from the client. - Martina_Corkery commented on July 8th 19 at 15:41
Yii::$app->request->get('param') - bryana.Renn commented on July 8th 19 at 15:44

Find more questions by tags YiiRESTful API