Update Log aktivitas

This commit is contained in:
2026-11-05 16:34:33 +07:00
parent a3ec431d49
commit 7a279ad5d2
84 changed files with 725 additions and 67 deletions
+15 -1
View File
@@ -28,10 +28,14 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use App\Models\Concerns\CatatAktivitas;
class Petani extends Model
{
use SoftDeletes, KembalikanStatusPetaniKeDraf;
use SoftDeletes, KembalikanStatusPetaniKeDraf, CatatAktivitas;
protected string $logAktivitas = 'petani';
protected string $labelAktivitas = 'Data petani';
protected $table = 'petani';
@@ -81,6 +85,16 @@ class Petani extends Model
'status' => 'draft',
];
// Log perpindahan status petani
public function catatPerubahanStatus(StatusDataPetani $dari, string $keterangan, array $tambahan = []): void
{
activity('verifikasi')
->performedOn($this)
->event('status')
->withProperties(array_filter(['dari' => $dari->value, 'ke' => $this->status?->value, ...$tambahan]))
->log($keterangan);
}
public function getUmurAttribute(): ?int
{
if (! $this->tanggal_lahir) {