Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Superuser;
|
||||
|
||||
use App\Http\Controllers\Prototype\ResourceController;
|
||||
use App\Support\Prototype\SuperuserData;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/** Log aktivitas: hanya baca. */
|
||||
class LogAktivitasController extends ResourceController
|
||||
{
|
||||
protected function rows(): Collection
|
||||
{
|
||||
return SuperuserData::aktivitas();
|
||||
}
|
||||
|
||||
protected function routeBase(): string
|
||||
{
|
||||
return 'superuser.log-aktivitas';
|
||||
}
|
||||
|
||||
protected function names(): array
|
||||
{
|
||||
return [
|
||||
'singular' => 'Aktivitas',
|
||||
'plural' => 'Log aktivitas',
|
||||
'description' => 'Jejak audit tindakan penting pengguna pada sistem, dari yang terbaru.',
|
||||
];
|
||||
}
|
||||
|
||||
protected function abilities(): array
|
||||
{
|
||||
return ['create' => false, 'show' => false, 'edit' => false, 'delete' => false];
|
||||
}
|
||||
|
||||
protected function perPage(): int
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected function search(): array
|
||||
{
|
||||
return ['deskripsi', 'pengguna', 'ip', 'aksi'];
|
||||
}
|
||||
|
||||
protected function filters(): array
|
||||
{
|
||||
$rows = $this->rows();
|
||||
|
||||
return [
|
||||
['name' => 'aksi', 'label' => 'Jenis aksi', 'options' => $rows->pluck('aksi')->unique()->sort()->mapWithKeys(fn (string $a): array => [$a => $a])->all()],
|
||||
['name' => 'pengguna', 'label' => 'Pengguna', 'options' => $rows->pluck('pengguna')->unique()->sort()->mapWithKeys(fn (string $p): array => [$p => $p])->all()],
|
||||
];
|
||||
}
|
||||
|
||||
protected function columns(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Waktu', 'key' => 'waktu'],
|
||||
['label' => 'Pengguna', 'key' => 'pengguna'],
|
||||
['label' => 'Aksi', 'key' => 'aksi', 'badge' => fn (array $r): string => match ($r['aksi']) {
|
||||
'Masuk' => 'success',
|
||||
'Gagal masuk' => 'danger',
|
||||
'Ubah data', 'Input nilai' => 'gold',
|
||||
'Terbitkan' => 'accent',
|
||||
default => 'neutral',
|
||||
}],
|
||||
['label' => 'Deskripsi', 'key' => 'deskripsi'],
|
||||
['label' => 'Alamat IP', 'key' => 'ip'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function fields(?array $row): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user