Update Log aktivitas
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user