kernel update

This commit is contained in:
2024-11-18 16:04:57 +03:00
parent 10605e17e7
commit 2af9ea876d
27 changed files with 434 additions and 91 deletions

View File

@ -32,7 +32,7 @@ class PostController extends AdminController
if ($postForm->validate()) {
$post = $this->postService->create($postForm);
if ($post) {
$this->redirect("/admin/post/" . $post->id);
$this->redirect("/admin/post/view/" . $post->id);
}
}
$this->redirect("/admin/post/create");
@ -87,7 +87,7 @@ class PostController extends AdminController
if ($postForm->validate()) {
$post = $this->postService->update($postForm, $post);
if ($post) {
$this->redirect("/admin/post/" . $post->id);
$this->redirect("/admin/post/view/" . $post->id);
}
}
$this->redirect("/admin/post/update/" . $id);

View File

@ -13,7 +13,7 @@ App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
App::$collector->get('/page/{page_number}', [\kernel\modules\post\controllers\PostController::class, 'actionIndex']);
App::$collector->get('/create', [\kernel\modules\post\controllers\PostController::class, 'actionCreate']);
App::$collector->post("/", [\kernel\modules\post\controllers\PostController::class, 'actionAdd']);
App::$collector->get('/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionView']);
App::$collector->get('/view/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionView']);
App::$collector->any('/update/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionUpdate']);
App::$collector->any("/edit/{id}", [\kernel\modules\post\controllers\PostController::class, 'actionEdit']);
App::$collector->get('/delete/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionDelete']);

View File

@ -1,16 +0,0 @@
<?php
namespace kernel\modules\post\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class PostDeleteActionColumn extends ActionColumn
{
protected string $prefix = "/delete/";
public function fetch(): string
{
$link = $this->baseUrl . $this->prefix . $this->id;
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace kernel\modules\post\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class PostEditActionColumn extends ActionColumn
{
protected string $prefix = "/update/";
public function fetch(): string
{
$link = $this->baseUrl . $this->prefix . $this->id;
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace kernel\modules\post\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class PostViewActionColumn extends actionColumn
{
protected string $prefix = "/";
public function fetch(): string
{
$link = $this->baseUrl . $this->prefix . $this->id;
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
}
}