action button update
This commit is contained in:
@ -11,6 +11,10 @@ use kernel\IGTabel\action_column\EditActionColumn;
|
||||
use kernel\IGTabel\action_column\ViewActionColumn;
|
||||
use kernel\IGTabel\btn\PrimaryBtn;
|
||||
use kernel\modules\option\models\Option;
|
||||
use kernel\widgets\IconBtn\IconBtnCreateWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
||||
|
||||
$table = new ListEloquentTable(new EloquentDataProvider(Option::class, [
|
||||
'current_page' => $page_number,
|
||||
@ -20,8 +24,7 @@ $table = new ListEloquentTable(new EloquentDataProvider(Option::class, [
|
||||
]));
|
||||
|
||||
$table->beforePrint(function () {
|
||||
return PrimaryBtn::create("Создать", "/admin/option/create")->fetch();
|
||||
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
|
||||
return IconBtnCreateWidget::create(['url' => '/admin/option/create'])->run();
|
||||
});
|
||||
|
||||
$table->columns([
|
||||
@ -31,8 +34,15 @@ $table->columns([
|
||||
}]
|
||||
]);
|
||||
|
||||
$table->addAction(ViewActionColumn::class);
|
||||
$table->addAction(EditActionColumn::class);
|
||||
$table->addAction(DeleteActionColumn::class);
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnViewWidget::create(['url' => '/admin/option/view/' . $row['id']])->run();
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnEditWidget::create(['url' => '/admin/option/update/' . $row['id']])->run();
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $row['id']])->run();
|
||||
});
|
||||
|
||||
$table->create();
|
||||
$table->render();
|
@ -8,15 +8,18 @@ use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
||||
use kernel\IGTabel\btn\DangerBtn;
|
||||
use kernel\IGTabel\btn\PrimaryBtn;
|
||||
use kernel\IGTabel\btn\SuccessBtn;
|
||||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnListWidget;
|
||||
|
||||
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($option, [
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/user",
|
||||
]));
|
||||
$table->beforePrint(function () use ($option) {
|
||||
$btn = PrimaryBtn::create("Список", "/admin/option")->fetch();
|
||||
$btn .= SuccessBtn::create("Редактировать", "/admin/option/update/" . $option->id)->fetch();
|
||||
$btn .= DangerBtn::create("Удалить", "/admin/option/delete/" . $option->id)->fetch();
|
||||
$btn = IconBtnListWidget::create(['url' => '/admin/option'])->run();
|
||||
$btn .= IconBtnEditWidget::create(['url' => '/admin/option/update/' . $option->id])->run();
|
||||
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $option->id])->run();
|
||||
return $btn;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user