33 lines
722 B
PHP
33 lines
722 B
PHP
<?php
|
|
namespace App\Controllers;
|
|
use Core\Token;
|
|
|
|
class Api
|
|
{
|
|
public function posts() {
|
|
$get = [
|
|
'data' => [
|
|
[
|
|
'id' => 1,
|
|
'judul' => 'post_1',
|
|
'status' => 1
|
|
],
|
|
[
|
|
'id' => 2,
|
|
'judul' => 'post_2',
|
|
'status' => 0
|
|
],
|
|
[
|
|
'id' => 3,
|
|
'judul' => 'post_3',
|
|
'status' => 2
|
|
]
|
|
]
|
|
];
|
|
|
|
$get['count'] = count($get['data']);
|
|
header('Content-Type: application/json');
|
|
echo json_encode($get);
|
|
}
|
|
}
|