master

laravel/framework

Last updated at: 29/12/2023 09:25

Dumpable.php

TLDR

The Dumpable.php file in the Illuminate\Support\Traits namespace contains a trait called Dumpable. This trait provides two methods: dd(...$args) and dump(...$args).

The dd(...$args) method dumps the given arguments and terminates the execution. It calls the dump(...$args) method and then calls the dd() function.

The dump(...$args) method dumps the given arguments. It calls the dump($this, ...$args) function and returns $this.

<?php

namespace Illuminate\Support\Traits;

trait Dumpable
{
    /**
     * Dump the given arguments and terminate execution.
     *
     * @param  mixed  ...$args
     * @return never
     */
    public function dd(...$args)
    {
        $this->dump(...$args);

        dd();
    }

    /**
     * Dump the given arguments.
     *
     * @param  mixed  ...$args
     * @return $this
     */
    public function dump(...$args)
    {
        dump($this, ...$args);

        return $this;
    }
}