| @@ 64-70 (lines=7) @@ | ||
| 61 | } |
|
| 62 | ||
| 63 | // check if message length is correct |
|
| 64 | if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
| 65 | throw new JsonException(__('Message length is incorrect. Current: %cur% , min - %min%, max - %max%', [ |
|
| 66 | 'cur' => Str::length($this->message), |
|
| 67 | 'min' => $this->_configs['minLength'], |
|
| 68 | 'max' => $this->_configs['maxLength'] |
|
| 69 | ])); |
|
| 70 | } |
|
| 71 | ||
| 72 | // sounds like answer, lets try to find post thread comment |
|
| 73 | if ($this->replayTo > 0) { |
|
| @@ 59-65 (lines=7) @@ | ||
| 56 | } |
|
| 57 | ||
| 58 | // check if message length is correct |
|
| 59 | if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
| 60 | throw new JsonException(__('Message length is incorrect. Current: %cur% , min - %min%, max - %max%', [ |
|
| 61 | 'cur' => Str::length($this->message), |
|
| 62 | 'min' => $this->_configs['minLength'], |
|
| 63 | 'max' => $this->_configs['maxLength'] |
|
| 64 | ])); |
|
| 65 | } |
|
| 66 | ||
| 67 | $count = CommentPost::where('id', '=', $this->replayTo)->count(); |
|
| 68 | if ($count !== 1) { |
|
| @@ 69-75 (lines=7) @@ | ||
| 66 | } |
|
| 67 | ||
| 68 | // check if message length is correct |
|
| 69 | if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
| 70 | throw new JsonException(__('Message length is incorrect. Current: %cur% , min - %min%, max - %max%', [ |
|
| 71 | 'cur' => Str::length($this->message), |
|
| 72 | 'min' => $this->_configs['minLength'], |
|
| 73 | 'max' => $this->_configs['maxLength'] |
|
| 74 | ])); |
|
| 75 | } |
|
| 76 | ||
| 77 | // check delay between 2 comments from 1 user or 1 ip |
|
| 78 | $query = CommentPost::where('user_id', '=', $this->_userId) |
|