option CRUD
This commit is contained in:
@ -67,6 +67,7 @@ class UserController extends AdminController
|
||||
* @throws RuntimeError
|
||||
* @throws SyntaxError
|
||||
* @throws LoaderError
|
||||
* @throws Exception
|
||||
*/
|
||||
public function actionUpdate($id): void
|
||||
{
|
||||
|
16
kernel/modules/user/table/columns/UserDeleteActionColumn.php
Normal file
16
kernel/modules/user/table/columns/UserDeleteActionColumn.php
Normal 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> ";
|
||||
}
|
||||
}
|
16
kernel/modules/user/table/columns/UserEditActionColumn.php
Normal file
16
kernel/modules/user/table/columns/UserEditActionColumn.php
Normal 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> ";
|
||||
}
|
||||
}
|
16
kernel/modules/user/table/columns/UserViewActionColumn.php
Normal file
16
kernel/modules/user/table/columns/UserViewActionColumn.php
Normal 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> ";
|
||||
}
|
||||
}
|
@ -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,
|
||||
|
Reference in New Issue
Block a user