2025-01-13 15:52:38 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var App\Models\User $user
|
|
|
|
*/
|
|
|
|
|
2025-01-22 13:13:49 +03:00
|
|
|
use App\Widgets\IconBtnDeleteWidget;
|
|
|
|
use App\Widgets\IconBtnEditWidget;
|
|
|
|
use App\Widgets\IconBtnListWidget;
|
2025-01-13 15:52:38 +03:00
|
|
|
use Itguild\EloquentTable\ViewEloquentTable;
|
|
|
|
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
|
|
|
|
|
|
|
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($user, [
|
|
|
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
|
|
'baseUrl' => "/admin/user",
|
|
|
|
]));
|
2025-01-22 13:13:49 +03:00
|
|
|
|
|
|
|
$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;
|
|
|
|
});
|
|
|
|
|
2025-01-13 15:52:38 +03:00
|
|
|
$table->rows([
|
|
|
|
'user_photo' => function ($data) {
|
|
|
|
return $data ? "<img src='$data' width='300px'>" : "";
|
|
|
|
},
|
|
|
|
'created_at' => function ($data) {
|
|
|
|
if (!$data) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (new DateTimeImmutable($data))->format("d-m-Y");
|
|
|
|
},
|
|
|
|
'updated_at' => function ($data) {
|
|
|
|
if (!$data) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (new DateTimeImmutable($data))->format("d-m-Y");
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
$table->create();
|
2025-01-20 16:57:48 +03:00
|
|
|
?>
|
|
|
|
|
|
|
|
<x-main>
|
|
|
|
<x-slot:title>
|
2025-01-22 13:13:49 +03:00
|
|
|
Custom Title
|
|
|
|
</x-slot>
|
2025-01-20 16:57:48 +03:00
|
|
|
|
2025-01-22 13:13:49 +03:00
|
|
|
@php
|
|
|
|
$table->render();
|
|
|
|
@endphp
|
2025-01-20 16:57:48 +03:00
|
|
|
|
|
|
|
</x-main>
|