Added admin privilages

This commit is contained in:
2017-09-05 14:03:55 +07:00
parent a4db3c8391
commit 57dc4ca0b9
5 changed files with 63 additions and 18 deletions

View File

@@ -41,4 +41,11 @@ class Home
}
}
}
public function logout()
{
if ($this->access->logout()) {
Redirect::to('/');
}
}
}

View File

@@ -20,10 +20,17 @@ class Posts
public function index()
{
$posts = $this->post->showAll();
$posts = $this->post->showAll(['status' => 1]);
$url = 'Data/pengumuman.html';
$status = '';
// echo "This is index of posts."; // Nanti di replace sama twig view ke App\Views\Data\pengumuman.html
View::render('Data/pengumuman.html', [
'posts' => $posts
if (Session::exists('userid')) {
$posts = $this->post->showAll();
$status = 'admin';
}
View::render($url, [
'posts' => $posts,
'status' => $status
]);
return true;
}