Added admin privilages
This commit is contained in:
@@ -41,4 +41,11 @@ class Home
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
if ($this->access->logout()) {
|
||||
Redirect::to('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user