| @@ 64-77 (lines=14) @@ | ||
| 61 | * |
|
| 62 | * @return boolean |
|
| 63 | */ |
|
| 64 | public static function valid($data) |
|
| 65 | { |
|
| 66 | $rules = [ |
|
| 67 | 'name' => 'required|min:3', |
|
| 68 | 'description' => 'min:3', |
|
| 69 | 'category_id' => 'required|min:0|integer|exists:forum_categories,id', |
|
| 70 | ]; |
|
| 71 | $validator = Validator::make($data, $rules); |
|
| 72 | ||
| 73 | if ($validator->passes()) { |
|
| 74 | return true; |
|
| 75 | } |
|
| 76 | return false; |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| @@ 42-55 (lines=14) @@ | ||
| 39 | * |
|
| 40 | * @return boolean |
|
| 41 | */ |
|
| 42 | public static function valid($data) |
|
| 43 | { |
|
| 44 | $rules = [ |
|
| 45 | 'body' => 'required|min:3', |
|
| 46 | 'post_id' => 'required|min:1|integer|exists:forum_posts,id', |
|
| 47 | 'author_id' => 'required|min:1|integer|exists:users,id' |
|
| 48 | ]; |
|
| 49 | $validator = Validator::make($data, $rules); |
|
| 50 | ||
| 51 | if ($validator->passes()) { |
|
| 52 | return true; |
|
| 53 | } |
|
| 54 | return false; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * Gets the number of replies from the database. |
|