22 lines
437 B
PHP
22 lines
437 B
PHP
<?php
|
|
|
|
namespace Api\Posts;
|
|
|
|
use Khofmann\Api\Api;
|
|
use Khofmann\Input\Input;
|
|
use Khofmann\Models\Post\Post;
|
|
use Khofmann\Request\Request;
|
|
use Khofmann\Response\Response;
|
|
|
|
class Posts extends Api
|
|
{
|
|
public function get()
|
|
{
|
|
$page = max(0, intval(Input::get("p", 0)));
|
|
$limit = constrain(0, 30, intval(Input::get("l", 10)));
|
|
$authed = Request::token() !== null;
|
|
|
|
Response::json(Post::list($page, $limit, $authed));
|
|
}
|
|
}
|