How to create previous and next links

My UserController has this code :


class UserController extends ActiveController

{

    public $modelClass = 'app\models\User';

}

My UserModel has this code:


public function getLinks()

{

    return [

        Link::REL_SELF => Url::to(['user/view', 'id' => $this->id], true),

    ];

}

In documentation you can see this response with next and previous links:


Link: <http://localhost/users?page=1>; rel=self,

      <http://localhost/users?page=2>; rel=next,

      <http://localhost/users?page=50>; rel=last

How you are supposed to make these ?

You should be able to see them in the response headers.