@@ -27,14 +27,14 @@ public function __construct(
2727 public function latest (int $ count = 20 , int $ page = 0 ): array
2828 {
2929 $ activityList = $ this ->permissions
30- ->restrictEntityRelationQuery (Activity::query (), 'activities ' , 'entity_id ' , 'entity_type ' )
30+ ->restrictEntityRelationQuery (Activity::query (), 'activities ' , 'loggable_id ' , 'loggable_type ' )
3131 ->orderBy ('created_at ' , 'desc ' )
3232 ->with (['user ' ])
3333 ->skip ($ count * $ page )
3434 ->take ($ count )
3535 ->get ();
3636
37- $ this ->listLoader ->loadIntoRelations ($ activityList ->all (), 'entity ' , false );
37+ $ this ->listLoader ->loadIntoRelations ($ activityList ->all (), 'loggable ' , false );
3838
3939 return $ this ->filterSimilar ($ activityList );
4040 }
@@ -59,14 +59,14 @@ public function entityActivity(Entity $entity, int $count = 20, int $page = 1):
5959 $ query ->where (function (Builder $ query ) use ($ queryIds ) {
6060 foreach ($ queryIds as $ morphClass => $ idArr ) {
6161 $ query ->orWhere (function (Builder $ innerQuery ) use ($ morphClass , $ idArr ) {
62- $ innerQuery ->where ('entity_type ' , '= ' , $ morphClass )
63- ->whereIn ('entity_id ' , $ idArr );
62+ $ innerQuery ->where ('loggable_type ' , '= ' , $ morphClass )
63+ ->whereIn ('loggable_id ' , $ idArr );
6464 });
6565 }
6666 });
6767
6868 $ activity = $ query ->orderBy ('created_at ' , 'desc ' )
69- ->with (['entity ' => function (Relation $ query ) {
69+ ->with (['loggable ' => function (Relation $ query ) {
7070 $ query ->withTrashed ();
7171 }, 'user.avatar ' ])
7272 ->skip ($ count * ($ page - 1 ))
@@ -82,7 +82,7 @@ public function entityActivity(Entity $entity, int $count = 20, int $page = 1):
8282 public function userActivity (User $ user , int $ count = 20 , int $ page = 0 ): array
8383 {
8484 $ activityList = $ this ->permissions
85- ->restrictEntityRelationQuery (Activity::query (), 'activities ' , 'entity_id ' , 'entity_type ' )
85+ ->restrictEntityRelationQuery (Activity::query (), 'activities ' , 'loggable_id ' , 'loggable_type ' )
8686 ->orderBy ('created_at ' , 'desc ' )
8787 ->where ('user_id ' , '= ' , $ user ->id )
8888 ->skip ($ count * $ page )
0 commit comments