30 lines
986 B
PHP
30 lines
986 B
PHP
<?php
|
|
|
|
/**
|
|
* @var \Illuminate\Database\Eloquent\Collection $tag
|
|
*/
|
|
|
|
use kernel\modules\user\models\User;
|
|
use Itguild\EloquentTable\ViewEloquentTable;
|
|
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
|
use kernel\IGTabel\btn\DangerBtn;
|
|
use kernel\IGTabel\btn\PrimaryBtn;
|
|
use kernel\IGTabel\btn\SuccessBtn;
|
|
|
|
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($tag, [
|
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
'baseUrl' => "/admin/tag",
|
|
]));
|
|
$table->beforePrint(function () use ($tag) {
|
|
$btn = PrimaryBtn::create("Список", "/admin/tag")->fetch();
|
|
$btn .= SuccessBtn::create("Редактировать", "/admin/tag/update/" . $tag->id)->fetch();
|
|
$btn .= DangerBtn::create("Удалить", "/admin/tag/delete/" . $tag->id)->fetch();
|
|
return $btn;
|
|
});
|
|
$table->rows([
|
|
'status' => (function ($data) {
|
|
return \kernel\app_modules\tag\models\Tag::getStatus()[$data];
|
|
})
|
|
]);
|
|
$table->create();
|
|
$table->render(); |