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