kernel update
This commit is contained in:
@ -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);
|
||||
|
@ -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']);
|
||||
|
@ -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> ";
|
||||
}
|
||||
}
|
@ -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> ";
|
||||
}
|
||||
}
|
@ -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> ";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user