Skip to content

Commit

Permalink
Merge branch 'add-dump-to-request' into 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 27, 2020
2 parents 55e924e + c43e08f commit 7ca3df6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Illuminate/Http/Concerns/InteractsWithInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Str;
use SplFileInfo;
use stdClass;
use Symfony\Component\VarDumper\VarDumper;

trait InteractsWithInput
{
Expand Down Expand Up @@ -462,4 +463,33 @@ protected function retrieveItem($source, $key, $default)

return $this->$source->get($key, $default);
}

/**
* Dump the request 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();

VarDumper::dump(count($keys) > 0 ? $this->only($keys) : $this->all());

return $this;
}
}

0 comments on commit 7ca3df6

Please sign in to comment.