Example #1
0
 protected static function boot()
 {
     parent::boot();
     static::created(function ($postvote) {
         Activity::create(['subject_id' => $postvote->post->id, 'subject_type' => Post::class, 'name' => 'created_postreport', 'user_id' => $postvote->user_id]);
     });
 }
Example #2
0
 protected static function boot()
 {
     parent::boot();
     static::created(function ($postvote) {
         if ($postvote->user_id) {
             //si es usuario invitado no guardar
             Activity::create(['subject_id' => $postvote->post->id, 'subject_type' => Post::class, 'name' => 'created_postvote', 'user_id' => $postvote->user_id]);
         }
     });
 }
Example #3
0
 protected function AddActivity($event)
 {
     Activity::create(['subject_id' => $this->id, 'subject_type' => get_class($this), 'name' => $this->getActivityName($this, $event), 'user_id' => $this->user_id]);
 }