Prechádzať zdrojové kódy

Merge pull request #828 from hedeqiang/2.0

Update JsonResponse.php
Jiang Qinghua 4 rokov pred
rodič
commit
94b802f7d3
1 zmenil súbory, kde vykonal 21 pridanie a 0 odobranie
  1. 21 0
      src/Http/JsonResponse.php

+ 21 - 0
src/Http/JsonResponse.php

@@ -359,6 +359,27 @@ class JsonResponse
                 sprintf('[%s] %s', get_class($exception), $exception->getMessage())
             );
     }
+    
+    
+    /**
+     * Flash a piece of data to the session.
+     *
+     * @param  string|array  $key
+     * @param  mixed  $value
+     * @return $this
+     */
+    public function with($key, $value = null)
+    {
+        $key = is_array($key) ? $key : [$key => $value];
+
+        foreach ($key as $k => $v) {
+            session()->flash($k, $v);
+        }
+
+        return $this;
+    }
+        
+    
 
     /**
      * @return \Illuminate\Http\JsonResponse