<?php /** * @var \Illuminate\Database\Eloquent\Collection $options * @var int $page_number */ use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; use kernel\IGTabel\action_column\DeleteActionColumn; 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, 'per_page' => 5, 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/option", ])); $table->beforePrint(function () { return IconBtnCreateWidget::create(['url' => '/admin/option/create'])->run(); }); $table->columns([ "status" => [ "value" => function ($cell) { return Option::getStatus()[$cell]; }] ]); $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();