PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
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 trunk 1.2.0 All 47 releases
fluent-cart / app / Http / Requests / FrontendRequests / CustomerRequests / CustomerProfileAccountDetailsRequest.php

CustomerProfileAccountDetailsRequest.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Http/Requests/FrontendRequests/CustomerRequests/CustomerProfileAccountDetailsRequest.php

57 lines 1.4 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\FrontendRequests\CustomerRequests;
4
5 use FluentCart\Framework\Foundation\RequestGuard;
6
7 class CustomerProfileAccountDetailsRequest extends RequestGuard
8 {
9
10 /**
11 * @return array
12 */
13 public function rules()
14 {
15
16 return [
17 'first_name' => 'sanitizeText|maxLength:255',
18 'last_name' => 'sanitizeText|maxLength:255',
19 'email' => 'required|email',
20 'current_password' => 'sanitizeText|nullable',
21 'new_password' => 'sanitizeText|nullable',
22 'confirm_new_password' => 'sanitizeText|nullable',
23 ];
24 }
25
26 /**
27 * @return array
28 */
29 public function messages()
30 {
31 return [
32 'email.required' => esc_html__('Email field is required.', 'fluent-cart')
33 ];
34 }
35
36 /**
37 * @return array
38 */
39 public function sanitize()
40 {
41 return [
42 'first_name' => 'sanitize_text_field',
43 'last_name' => 'sanitize_text_field',
44 'email' => function ($value) {
45 if(empty($value)) {
46 return '';
47 }
48
49 return sanitize_email($value);
50 },
51 'new_password' => '',
52 'current_password' => '',
53 'confirm_new_password' => ''
54 ];
55 }
56 }
57