crud menu

This commit is contained in:
2024-08-30 16:14:31 +03:00
parent 5b4676a4c0
commit c325b156bd
28 changed files with 442 additions and 132 deletions

View File

@ -30,16 +30,10 @@ class PostController extends Controller
$postForm = new CreatePostForm();
$postService = new PostService();
$postForm->load($_REQUEST);
// Debug::dd($_REQUEST);
if(UserService::check($_REQUEST['user_id'])) {
// Debug::dd(123);
if ($postForm->validate()) {
// Debug::dd($postForm);
$post = $postService->create($postForm);
if ($post) {
$this->redirect("/admin/post/" . $post->id);
}
if ($postForm->validate()) {
$post = $postService->create($postForm);
if ($post) {
$this->redirect("/admin/post/" . $post->id);
}
}
$this->redirect("/admin/post/create");
@ -49,11 +43,9 @@ class PostController extends Controller
* @throws Exception
*/
public function actionIndex(): void
public function actionIndex($page_number = 1): void
{
$contents = Post::all();
$this->cgView->render("post/index.php", ['contents' => $contents]);
$this->cgView->render("post/index.php", ['page_number' => $page_number]);
}
/**