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 / UserRequest.php

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

52 lines 1.2 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 UserRequest extends RequestGuard
8 {
9 /**
10 * @return array
11 */
12 public function rules()
13 {
14 return [
15 'email' => 'required|email|unique:users,user_email',
16 'password' => 'nullable|sanitizeText',
17 'full_name' => 'required'
18 ];
19 }
20
21 /**
22 * @return array
23 */
24 public function messages()
25 {
26 return [
27 'email.required' => esc_html__('Email is required', 'fluent-cart'),
28 'email.email' => esc_html__('Please enter a valid email address.', 'fluent-cart'),
29 'email.unique' => esc_html__('This email is already registered.', 'fluent-cart'),
30 'full_name.required' => esc_html__('Full name is required', 'fluent-cart')
31 ];
32 }
33
34 /**
35 * @return array
36 */
37 public function sanitize()
38 {
39 return [
40 'email' => function ($value) {
41 if(empty($value)) {
42 return '';
43 }
44
45 return sanitize_email($value);
46 },
47 'full_name' => 'sanitize_text_field',
48 'password' => ''
49 ];
50 }
51 }
52