CollaborationCommentDestroyRequest.php
3 weeks ago
CollaborationCommentResolveRequest.php
3 weeks ago
CollaborationCommentStoreRequest.php
3 weeks ago
CollaborationCommentStoreRequest.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kirki\App\Http\Requests\CollaborationComment; |
| 4 | |
| 5 | use Kirki\App\Constants\CollaborationComment\CommentSegmentTypes; |
| 6 | use Kirki\Framework\Http\Request; |
| 7 | use Kirki\Framework\Sanitizer; |
| 8 | |
| 9 | class CollaborationCommentStoreRequest extends Request |
| 10 | { |
| 11 | /** |
| 12 | * Validation rules. |
| 13 | */ |
| 14 | public function rules() |
| 15 | { |
| 16 | return [ |
| 17 | 'comment' => 'required|array|min:1', |
| 18 | 'comment.*.type' => 'required|string|in:' . CommentSegmentTypes::join(), |
| 19 | 'comment.*.value' => 'nullable', |
| 20 | 'post_id' => 'required|integer', |
| 21 | 'parent_id' => 'nullable|integer', |
| 22 | 'status' => 'nullable|integer', |
| 23 | 'meta_data' => 'nullable|array', |
| 24 | 'meta_data.kirki_element_id' => 'nullable|string|max:191', |
| 25 | 'meta_data.position' => 'nullable|array', |
| 26 | 'meta_data.position.x' => 'nullable|number', |
| 27 | 'meta_data.position.y' => 'nullable|number', |
| 28 | 'session_id' => 'nullable|string', |
| 29 | ]; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Sanitization filters. |
| 34 | */ |
| 35 | public function filters() |
| 36 | { |
| 37 | return [ |
| 38 | 'comment' => Sanitizer::ARRAY , |
| 39 | 'comment.*.type' => Sanitizer::TEXT, |
| 40 | 'post_id' => Sanitizer::INT, |
| 41 | 'parent_id' => Sanitizer::INT, |
| 42 | 'status' => Sanitizer::INT, |
| 43 | 'meta_data' => Sanitizer::ARRAY , |
| 44 | 'meta_data.kirki_element_id' => Sanitizer::TEXT, |
| 45 | 'meta_data.position.x' => Sanitizer::DOUBLE, |
| 46 | 'meta_data.position.y' => Sanitizer::DOUBLE, |
| 47 | 'session_id' => Sanitizer::TEXT, |
| 48 | ]; |
| 49 | } |
| 50 | } |
| 51 |