Conditions | 3 |
Paths | 9 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Taskforcedev\LaravelForum\Helpers; |
||
19 | public function getPostCount($user_id) |
||
20 | { |
||
21 | /* Get count from forum posts */ |
||
22 | try { |
||
23 | $posts = ForumPost::where('author_id', $user_id)->get(); |
||
24 | $posts = count($posts); |
||
25 | } catch (Exception $e) { |
||
26 | $posts = 0; |
||
27 | } |
||
28 | |||
29 | /* Get count from forum replies */ |
||
30 | try { |
||
31 | $replies = ForumReply::where('author_id', $user_id)->get(); |
||
32 | $replies = count($replies); |
||
33 | } catch (Exception $e) { |
||
34 | $replies = 0; |
||
35 | } |
||
36 | |||
37 | /* Return total */ |
||
38 | return $posts + $replies; |
||
39 | } |
||
40 | } |
||
41 |