I’m beginner on Laravel…
How to debug some value on controller in Laravel, result can show to console like syntax console.log()
on javascript?
example controller function :
class TestMeController extends Controller { public function __construct() { $this->middleware('jsonify'); } public function callMe($id) { $params = Request::all(); console.log($id); <== how to write code on Laravel? } }
Advertisement
Answer
In Laravel use dd($id)
or if you don’t want to halt the execution, you can use dump($var)
.
You can still always use PHP’s native functions like var_dump
, die
and print_r
.