Search code examples
phplaravellaravel-5dumpdd

Console data in PHP laravel controller


Following is my code of the controller. I'm calling this controller, but still unable to do any console. Am I doing anything wrong here? I just want to observe values in console, functionality is working fine.

public function registerValidation(Request $request)
    {
        dd("request 2");
        var_dump("request 2");
        dump("request 2");
        dd($request);
        var_dump($request);
        dump($request);
        die("here");
        $this->validate(
            $request,
            [
                'password' => 'required|string|min:6|confirmed',
                'password_confirmation' => 'required',
                'termsconditions' => 'required',
            ]
        );
    }

Solution

  • dd is short for dump and die, and will stop execution of your code.

    You're probably looking for var_dump() if you're running your code in console, or error_log() if you're using your site in a browser, and watching the logs (with something like tail -f /var/log/apache2/error.log).