Adding token and current timestamp to html.
This commit is contained in:
@@ -3,6 +3,7 @@ namespace App\Controllers;
|
||||
|
||||
use \Core\View;
|
||||
use App\Models\Post;
|
||||
use \Core\Token;
|
||||
|
||||
class Posts
|
||||
{
|
||||
@@ -26,9 +27,13 @@ class Posts
|
||||
public function entry()
|
||||
{
|
||||
$categories = $this->model->showCategories();
|
||||
$date = new \DateTime();
|
||||
$timestamp = $date->format('Y/m/d H:i:s');
|
||||
// echo "You can entry new data here."; // Nanti di replace sama twig view ke App\Views\Data\entry_pengumuman.html
|
||||
View::render('Data/entry_pengumuman.html', [
|
||||
'categories' => $categories
|
||||
'categories' => $categories,
|
||||
'timestamp' => $timestamp,
|
||||
'token' => Token::generate()
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
@@ -37,6 +42,8 @@ class Posts
|
||||
{
|
||||
if ($id) {
|
||||
$posts = $this->model->showSingle($id);
|
||||
$date = new \DateTime();
|
||||
$timestamp = $date->format('Y/m/d H:i:s');
|
||||
// echo "You can edit exists data with id $id here"; // Nanti di replace sama twig view ke App\Views\Data\edit_pengumuman.html
|
||||
View::render(
|
||||
'Data/edit_pengumuman.html',
|
||||
@@ -46,7 +53,9 @@ class Posts
|
||||
'created_at' => $posts['created_at'],
|
||||
'creator' => $posts['creator'],
|
||||
'edited_at' => $posts['edited_at'],
|
||||
'editor' => $posts['editor']
|
||||
'editor' => $posts['editor'],
|
||||
'timestamp' => $timestamp,
|
||||
'token' => Token::generate()
|
||||
]
|
||||
);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user