1
- <?php namespace Syntax \Core \Traits ;
1
+ <?php namespace Syntax \Forum \Traits ;
2
2
3
3
class ForumableUserTrait {
4
4
@@ -25,17 +25,17 @@ public function checkUnreadBoard($boardId)
25
25
// return Forum_Board::where('id', '=', $boardId)->or_where('parent_id', '=', $boardId)->get()->unreadFlagForUser($this->id);
26
26
27
27
// Get all parent and child boards matching the id
28
- $ boardIds = Forum_Board::where ('uniqueId ' , $ boardId )->orWhere ('parent_id ' , '= ' , $ boardId )->get ()->id ->toArray ();
28
+ $ boardIds = \ Forum_Board::where ('uniqueId ' , $ boardId )->orWhere ('parent_id ' , '= ' , $ boardId )->get ()->id ->toArray ();
29
29
30
30
// Get any posts within those boards
31
- $ posts = Forum_Post::whereIn ('forum_board_id ' , $ boardIds )->get ();
31
+ $ posts = \ Forum_Post::whereIn ('forum_board_id ' , $ boardIds )->get ();
32
32
$ postIds = $ posts ->id ->toArray ();
33
33
34
34
// Make sure there are posts
35
35
if (count ($ postIds ) > 0 ) {
36
36
37
37
// See which of these posts the user has already viewed
38
- $ viewedPosts = Forum_Post_View::where ('user_id ' , '= ' , $ this ->id )->whereIn ('forum_post_id ' , $ postIds )->get ();
38
+ $ viewedPosts = \ Forum_Post_View::where ('user_id ' , '= ' , $ this ->id )->whereIn ('forum_post_id ' , $ postIds )->get ();
39
39
40
40
// If the posts are greater than the viewed, there are new posts
41
41
if (count ($ posts ) > count ($ viewedPosts )) {
@@ -53,7 +53,7 @@ public function checkUnreadBoard($boardId)
53
53
public function unreadPostCount ()
54
54
{
55
55
// Get the id of all posts
56
- $ posts = Forum_Post::all ();
56
+ $ posts = \ Forum_Post::all ();
57
57
$ postsCount = $ posts ->count ();
58
58
59
59
if ($ postsCount > 0 ) {
@@ -65,7 +65,7 @@ public function unreadPostCount()
65
65
$ postIds = $ posts ->id ->toArray ();
66
66
67
67
// See which of these the user has viewed
68
- $ viewedPostCount = Forum_Post_View::where ('user_id ' , $ this ->id )->whereIn ('forum_post_id ' , $ postIds )->count ();
68
+ $ viewedPostCount = \ Forum_Post_View::where ('user_id ' , $ this ->id )->whereIn ('forum_post_id ' , $ postIds )->count ();
69
69
70
70
// If there are more posts than viewed posts, return the remainder
71
71
if ($ postsCount > $ viewedPostCount ) {
0 commit comments