diff --git a/src/Illuminate/Http/Concerns/InteractsWithInput.php b/src/Illuminate/Http/Concerns/InteractsWithInput.php index 4550271b0f61..6be4a4608d56 100644 --- a/src/Illuminate/Http/Concerns/InteractsWithInput.php +++ b/src/Illuminate/Http/Concerns/InteractsWithInput.php @@ -7,6 +7,7 @@ use Illuminate\Support\Str; use SplFileInfo; use stdClass; +use Symfony\Component\VarDumper\VarDumper; trait InteractsWithInput { @@ -462,4 +463,39 @@ protected function retrieveItem($source, $key, $default) return $this->$source->get($key, $default); } + + /** + * Dump the items and end the script. + * + * @param array|mixed $keys + * @return void + */ + public function dd(...$keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + call_user_func_array([$this, 'dump'], $keys); + + exit(1); + } + + /** + * Dump the items. + * + * @return $this + */ + public function dump($keys = []) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + if (count($keys) > 0) { + $data = $this->only($keys); + } else { + $data = $this->all(); + } + + VarDumper::dump($data); + + return $this; + } }