backend/views/admin/post/view.php

24 lines
859 B
PHP
Raw Normal View History

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