Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public static function checkRateable($content_type, $content_id, $user_id) |
||
13 | { |
||
14 | $comments = \DB::table('comments') |
||
15 | ->selectRaw('SUM(comments.vote_up) as up, SUM(comments.vote_down) as down') |
||
16 | ->where('comments.content_id', '=', $content_id) |
||
17 | ->where('comments.content_type', '=', $content_type) |
||
18 | ->where('comments.user_id', '=', $user_id) |
||
19 | ->first(); |
||
20 | |||
21 | if ($comments->up > 0 || $comments->down > 0) { |
||
22 | return false; |
||
23 | } else { |
||
24 | return true; |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 |