backend/views/admin/user/view.php
2024-07-25 13:23:50 +03:00

24 lines
844 B
PHP

<?php
/**
* @var \Illuminate\Database\Eloquent\Collection $user
*/
use Itguild\Tables\ViewJsonTable;
use kernel\IGTabel\btn\DangerBtn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\btn\SuccessBtn;
use kernel\IGTabel\ViewJsonTableEloquentModel;
$dataProvider = new ViewJsonTableEloquentModel($user, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]);
$table = new ViewJsonTable($dataProvider->getJson());
$table->beforeTable(function () use ($user) {
$btn = PrimaryBtn::create("Список", "/admin/user")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/user/update/" . $user->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/user/delete/" . $user->id)->fetch();
return $btn;
});
$table->create();
$table->render();