app/RecordsActivity.php
// Laravel toggle it in boot() of Thread.
Laravel toggle it in boot() of Thread.
Laravel toggle it in boot () of Thread .
protected static function bootRecordsActivity()
    {
        if (auth()->guest()) {
            return;
        }
        foreach (static::getActivityToRecord() as $event) {
            static::$event(function ($model) use ($event) {
                $model->recordActivity($event);
            });
        }
        static::deleting(function ($model) {
            $model->activity()->delete();
        });
    }
protected static function bootRecordsActivity ( ) { if ( auth ( ) -> guest ( ) ) { return ; } foreach ( static :: getActivityToRecord ( ) as $ event ) { static :: $ event ( function ( $ model ) use ( $ event ) { $ model -> recordActivity ( $ event ) ; } ) ; } static :: deleting ( function ( $ model ) { $ model -> activity ( ) -> delete ( ) ; } ) ; }
Laravel toggle it in boot() of Thread.
Laravel toggle it in boot () of Thread .
// Prevent from 'Integrity constraint violation'. /* static::created(function ($thread) {
                $thread->recordActivity('created');
            }); */ /**
         * Add new event listner.
         * If threads are deleted, their associated activities will be also deleted.
         *
         * This will ONLY fire on the model like $favorite->delete().
         * If u have some sql query like unfavorite() method in favoritable,
         * it won't be toggled.
         *
         * Another bug: if we delete a reply, it will delete the activity of reply model,
         * but not favorite model.
         *
         * Solution: A reply can be favoritable(trait), we settle up a model event in the favoritable
         * If the associated model is ever deleted, as part of that relation I also want you to delete
         * the favorites for the model
         * @return void
         */