@@ -122,29 +122,37 @@ public function validate($closure = null)
122122
123123 /**
124124 * Form save response
125- *
125+ *
126126 * @param Closure $function
127127 * @return mixed
128128 */
129129 public function save ($ closure )
130130 {
131- // if validation already failed, return stored JsonResponse
131+ // If user returns a JsonResponse
132132 if (ValidatorMethod::isJsonResponse ($ this ->jsonResponse )) {
133- return $ this ->jsonResponse ;
133+ return $ this ->jsonResponse -> send () ;
134134 }
135135
136136 if ($ this ->isValidated ()){
137-
137+
138138 // save into a remembering variable
139139 ValidatorMethod::resolveFlash ($ this );
140-
140+
141141 $ response = $ this ->callback ($ closure );
142142
143- // If user returns a JsonResponse in save, return it
143+ dd (
144+ 'sss '
145+ );
146+ exit ();
147+
148+ // If user returns a JsonResponse in save, send and return it
144149 if (ValidatorMethod::isJsonResponse ($ response )) {
145- return $ response ;
150+ if (!$ this ->responseSent ) {
151+ $ response ->send ();
152+ $ this ->responseSent = true ;
153+ }
146154 }
147-
155+
148156 // delete csrf session token
149157 CsrfToken::unsetToken ();
150158 }
@@ -265,6 +273,16 @@ public function merge($keys = null, $data = null)
265273 return ValidatorMethod::merge ($ keys , $ data );
266274 }
267275
276+ /**
277+ * Get Attribute Data
278+ *
279+ * @return mixed
280+ */
281+ public function getAttribute ()
282+ {
283+ return $ this ->attribute ;
284+ }
285+
268286 /**
269287 * Return previously entered value
270288 *
0 commit comments