PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.19
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.19
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Http / Requests / AttrGroupRequest.php

AttrGroupRequest.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.19, at app/Http/Requests/AttrGroupRequest.php

60 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Http\Requests;
4
5 use FluentCart\Framework\Foundation\RequestGuard;
6
7 class AttrGroupRequest extends RequestGuard
8 {
9
10 /**
11 * title can not be empty
12 *
13 * todo - AR_Docs
14 *
15 * Usage of unique - unique:tbl,col ; unique:tbl,col,pk_val; unique:tbl,col,pk_col,pk_val; does not support more than 4 parameter.
16 *
17 * @return string[]
18 */
19 public function rules()
20 {
21 $groupId = $this->get('group_id');
22 $tbl = 'fct_atts_groups';
23
24 return [
25 'title' => 'required|sanitizeText|maxLength:50|unique:' . $tbl . ',title,' . $groupId.',id',
26 'slug' => 'required|sanitizeText|maxLength:50|unique:' . $tbl . ',slug,' . $groupId.',id',
27 'description' => 'nullable|sanitizeTextArea',
28
29 ];
30 }
31
32 /**
33 *
34 * @return array
35 */
36 public function messages()
37 {
38 return [
39 'title' => esc_html__('Group title can not be empty and must be unique.', 'fluent-cart'),
40 'slug' => esc_html__('Group slug can not be empty and must be unique.', 'fluent-cart'),
41 'description' => esc_html__('Group description should be long text.', 'fluent-cart'),
42 'settings' => esc_html__('Group settings should be long text.', 'fluent-cart'),
43 ];
44 }
45
46
47 /**
48 *
49 * @return array
50 */
51 public function sanitize()
52 {
53 return [
54 'title' => 'sanitize_text_field',
55 'description' => 'sanitize_text_field',
56 'slug' => 'sanitize_text_field'
57 ];
58 }
59 }
60