| Conditions | 6 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function conversationExists($to, $from) |
||
| 34 | { |
||
| 35 | //prevent to pm yourself |
||
| 36 | if(auth()->user()->name == $to->name){ |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | //check if conversation already exists |
||
| 40 | if (count(Conversation::where('id_to', $to->id)->first()) == 1 AND count(Conversation::where('id_from', $from)->first()) == 1 OR count(Conversation::where('id_to', $from)->first()) == 1 AND count(Conversation::where('id_from', $to->id)->first()) == 1) { |
||
| 41 | return true; |
||
| 42 | } |
||
| 43 | return false; |
||
| 44 | } |
||
| 46 | } |