Laravel_App/resources/views/user/view.blade.php

46 lines
907 B
PHP

<?php
/**
* @var App\Models\User $user
*/
use Itguild\EloquentTable\ViewEloquentTable;
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($user, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$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();
?>
<x-main>
<x-slot:title>
Custom Title
</x-slot>
@php
$table->render();
@endphp
</x-main>