Sep 17, 2014

Debug Laravel View

Laravel is a very nice framework, except some annoying.

One of it is the famous "Method Illuminate\View\View::__toString() must not throw an exception".
We often found this in the end of an action in a controller:

return View::make('path/view');
This implicitly converts the View to a string, by calling magic __toString() method. If something wrong with the view, we are shielded from seeing what happen.

To get around, use the explicit version:
return View::make('path/view')->render();
You will get your desire and "real" exception caused the view die!

No comments:

Post a Comment

New comment