/** * Delete post */ public function delete() { if (isset($_SESSION['login']) && $_SESSION['login'] === true) { if (is_array(func_get_args())) { if (is_array(func_get_args()[0])) { $id = func_get_args()[0][0]; if (preg_match('/[0-9]+$/', $id, $match)) { if (Model::delete('posts', $match[0])) { $this->redirectTo('posts/index'); } } } } return $this->redirectTo('posts/index'); } else { return $this->redirectTo('posts/index'); } }