2024-07-25 11:55:31 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \Illuminate\Database\Eloquent\Collection $user
|
|
|
|
*/
|
|
|
|
use Itguild\Tables\ViewJsonTable;
|
2024-07-25 13:23:50 +03:00
|
|
|
use kernel\IGTabel\btn\DangerBtn;
|
2024-07-25 11:55:31 +03:00
|
|
|
use kernel\IGTabel\btn\PrimaryBtn;
|
2024-07-25 13:23:50 +03:00
|
|
|
use kernel\IGTabel\btn\SuccessBtn;
|
2024-07-25 11:55:31 +03:00
|
|
|
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();
|
2024-07-25 13:23:50 +03:00
|
|
|
$btn .= SuccessBtn::create("Редактировать", "/admin/user/update/" . $user->id)->fetch();
|
|
|
|
$btn .= DangerBtn::create("Удалить", "/admin/user/delete/" . $user->id)->fetch();
|
2024-07-25 11:55:31 +03:00
|
|
|
return $btn;
|
|
|
|
});
|
|
|
|
$table->create();
|
|
|
|
$table->render();
|