crud menu
This commit is contained in:
@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user