PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.20
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.20
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 / AttrTermRequest.php

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

56 lines 1.3 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 AttrTermRequest extends RequestGuard
8 {
9
10 /**
11 * @return array
12 */
13 public function rules()
14 {
15 $termId = $this->get('term_id');
16 $tbl = 'fct_atts_terms';
17
18 /**
19 * todo - consult with heera bhai how to proceed with this composit unique validation
20 *
21 */
22 return [
23 'title' => 'required|sanitizeText|maxLength:50|unique:' . $tbl . ',title,'.$termId.',id',
24 'slug' => 'required|sanitizeText|maxLength:50|unique:' . $tbl . ',slug,'.$termId.',id',
25 'description' => 'nullable|sanitizeTextArea',
26 'serial' => 'nullable|numeric'
27 ];
28 }
29
30
31 /**
32 * @return array
33 */
34 public function messages()
35 {
36 return [
37 'title.required' => esc_html__('Title is required', 'fluent-cart'),
38 'slug.required' => esc_html__('Slug is required', 'fluent-cart'),
39
40 ];
41 }
42
43
44 /**
45 * @return array
46 */
47 public function sanitize()
48 {
49 return [
50 'serial' => 'sanitize_text_field',
51 'description' => 'sanitize_text_field',
52 'slug' => 'sanitize_text_field'
53 ];
54 }
55 }
56