$record=ListBrf::where('department_id',$v)->latest()->first();activity()->inLog('logname')->performedOn($record)// Specify the model related to the activity (optional)->causedBy(auth()->user())// Specify the user causing the activity (optional)->withProperties(['customProperty'=>'customValue'])// Additional details (optional)->createdAt(now())->event('verified')->log('Your custom log message');
publicfunctionsetCustomDescription($description){$this->customDescription=$description;}publicfunctiongetActivitylogOptions():LogOptions{returnLogOptions::defaults()->logOnly(['*'])->useLogName('List BRF')->setDescriptionForEvent(function(string$eventName){// Set a custom description based on the event typeif($this->step_status){return$this->step_status_detail($this->step_status);}returnmatch($eventName){'created'=>"A new record was created with ID {$this->id}",'updated'=>"The record with ID {$this->id} was updated",'deleted'=>"The record with ID {$this->id} was deleted",default=>"Performed {$eventName} on record with ID {$this->id}"};});}///how to use$this->setCustomDescription($this->step_status_detail($btu_step_status));
Leave a Reply