option CRUD

This commit is contained in:
2024-09-23 15:33:48 +03:00
parent f4971f1c7d
commit 0f05bc2391
35 changed files with 737 additions and 147 deletions

View File

@ -67,6 +67,7 @@ class UserController extends AdminController
* @throws RuntimeError
* @throws SyntaxError
* @throws LoaderError
* @throws Exception
*/
public function actionUpdate($id): void
{

View File

@ -0,0 +1,16 @@
<?php
namespace kernel\modules\user\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class UserDeleteActionColumn 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

@ -0,0 +1,16 @@
<?php
namespace kernel\modules\user\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class UserEditActionColumn 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

@ -0,0 +1,16 @@
<?php
namespace kernel\modules\user\table\columns;
use Itguild\Tables\ActionColumn\ActionColumn;
class UserViewActionColumn 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> ";
}
}

View File

@ -4,13 +4,14 @@
* @var int $page_number
*/
use app\tables\columns\user\UserDeleteActionColumn;
use app\tables\columns\user\UserEditActionColumn;
use app\tables\columns\user\UserViewActionColumn;
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\modules\user\models\User;
use kernel\modules\user\table\columns\UserDeleteActionColumn;
use kernel\modules\user\table\columns\UserEditActionColumn;
use kernel\modules\user\table\columns\UserViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(User::class, [
'currentPage' => $page_number,