Skip to content

Commit 7ca3df6

Browse files
committed
Merge branch 'add-dump-to-request' into 8.x
2 parents 55e924e + c43e08f commit 7ca3df6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/Illuminate/Http/Concerns/InteractsWithInput.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Str;
88
use SplFileInfo;
99
use stdClass;
10+
use Symfony\Component\VarDumper\VarDumper;
1011

1112
trait InteractsWithInput
1213
{
@@ -462,4 +463,33 @@ protected function retrieveItem($source, $key, $default)
462463

463464
return $this->$source->get($key, $default);
464465
}
466+
467+
/**
468+
* Dump the request items and end the script.
469+
*
470+
* @param array|mixed $keys
471+
* @return void
472+
*/
473+
public function dd(...$keys)
474+
{
475+
$keys = is_array($keys) ? $keys : func_get_args();
476+
477+
call_user_func_array([$this, 'dump'], $keys);
478+
479+
exit(1);
480+
}
481+
482+
/**
483+
* Dump the items.
484+
*
485+
* @return $this
486+
*/
487+
public function dump($keys = [])
488+
{
489+
$keys = is_array($keys) ? $keys : func_get_args();
490+
491+
VarDumper::dump(count($keys) > 0 ? $this->only($keys) : $this->all());
492+
493+
return $this;
494+
}
465495
}

0 commit comments

Comments
 (0)