Completed
Pull Request — master (#70)
by Felix
01:58
created
src/Felixkiss/UniqueWithValidator/UniqueWithValidatorServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
     {
27 27
         // Whenever the validator factory is accessed in the container, we set
28 28
         // the custom resolver on it (this works in Larvel >= 5.2 as well).
29
-        $this->app->resolving('validator', function ($factory, $app) {
30
-            $factory->resolver(function ($translator, $data, $rules, $messages, $customAttributes = []) {
29
+        $this->app->resolving('validator', function($factory, $app) {
30
+            $factory->resolver(function($translator, $data, $rules, $messages, $customAttributes = []) {
31 31
                 return new ValidatorExtension(
32 32
                     $translator,
33 33
                     $data,
Please login to merge, or discard this patch.
src/Felixkiss/UniqueWithValidator/ValidatorExtension.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     public function __construct($translator, $data, $rules, $messages, array $customAttributes = array())
11 11
     {
12 12
         // Set custom validation error messages
13
-        if(!isset($messages['unique_with']))
13
+        if (!isset($messages['unique_with']))
14 14
         {
15 15
             $messages['unique_with'] = $translator->get(
16 16
                 'uniquewith-validator::validation.unique_with'
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
     public function __construct($translator, $data, $rules, $messages, array $customAttributes = array())
11 11
     {
12 12
         // Set custom validation error messages
13
-        if(!isset($messages['unique_with']))
14
-        {
13
+        if(!isset($messages['unique_with'])) {
15 14
             $messages['unique_with'] = $translator->get(
16 15
                 'uniquewith-validator::validation.unique_with'
17 16
             );
@@ -59,28 +58,23 @@  discard block
 block discarded – undo
59 58
         // case 2:
60 59
         //     $parameter = 'last_name=sur_name'
61 60
         //     => field_name = 'last_name', column_name = 'sur_name'
62
-        foreach ($parameters as $parameter)
63
-        {
61
+        foreach ($parameters as $parameter) {
64 62
             $parameter = array_map('trim', explode('=', $parameter, 2));
65 63
             $field_name = $parameter[0];
66 64
 
67
-            if (count($parameter) > 1)
68
-            {
65
+            if (count($parameter) > 1) {
69 66
                 $column_name = $parameter[1];
70 67
             }
71
-            else
72
-            {
68
+            else {
73 69
                 $column_name = $field_name;
74 70
             }
75 71
 
76 72
             // Figure out whether main field_name has an explicitly specified
77 73
             // column_name
78
-            if ($field_name == $column)
79
-            {
74
+            if ($field_name == $column) {
80 75
                 $column = $column_name;
81 76
             }
82
-            else
83
-            {
77
+            else {
84 78
                 $extra[$column_name] = array_get($this->data, $field_name);
85 79
             }
86 80
         }
@@ -134,8 +128,7 @@  discard block
 block discarded – undo
134 128
 
135 129
         // An ignore_id is only specified if the last param starts with a
136 130
         // number greater than 1 (a valid id in the database)
137
-        if (!preg_match('/^[1-9][0-9]*$/', $lastParam[0]))
138
-        {
131
+        if (!preg_match('/^[1-9][0-9]*$/', $lastParam[0])) {
139 132
             return array(null, null);
140 133
         }
141 134
 
Please login to merge, or discard this patch.