I'd like to insert a code snippet into Laravel's error pages, but I can't figure out how to modify or capture the output.
This filthy hack seems to work, but the snippet is inserted before any page code.
// In laravel/app/start/global.php
App::error(function (Exception, $exception, $code)
{
echo '<script src="//localhost:35729/livereload.js"></script>';
});
The error pages are in resources/views/errors. You can then simply add whatever you want inside those file by naming them with the status code like 503.blade.php
.
You can even make a base error page and the other view extends this one.
You can also take a look at the \\App\\Exceptions\\Handler
class in the report
method, you can check Exceptions that have been thrown there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.