action btns icon widgets add

This commit is contained in:
2025-01-22 13:13:49 +03:00
parent 22f7ecff6a
commit 265300f345
9 changed files with 131 additions and 34 deletions

View File

@ -4,6 +4,9 @@
* @var App\Models\User $user
*/
use App\Widgets\IconBtnDeleteWidget;
use App\Widgets\IconBtnEditWidget;
use App\Widgets\IconBtnListWidget;
use Itguild\EloquentTable\ViewEloquentTable;
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
@ -11,6 +14,14 @@ $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($user, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$table->beforePrint(function () use ($user) {
$btn = (new IconBtnListWidget(['url' => '/admin/user']))->run();
$btn .= (new IconBtnEditWidget(['url' => '/admin/user/update/' . $user->id]))->run();
$btn .= (new IconBtnDeleteWidget(['url' => '/admin/user/delete/' . $user->id]))->run();
return $btn;
});
$table->rows([
'user_photo' => function ($data) {
return $data ? "<img src='$data' width='300px'>" : "";
@ -35,11 +46,11 @@ $table->create();
<x-main>
<x-slot:title>
Custom Title
</x-slot>
Custom Title
</x-slot>
@php
$table->render();
@endphp
@php
$table->render();
@endphp
</x-main>