And as you organizovati error output in laravel?

Hi all. Recently started to learn laravel and I postal the question of how best to organize the output errors.
At the moment, tried to organize in the following way:
1. Slightly expanded base exception Handler in the render method depends on what type of request resulted in an error:
public function render($request, Exception $e)
{
 $statusCode = $this->getStatusCode($e);

 if ($request->wantsJson()) {
 return response()->json(['message' => $e->getMessage()], $statusCode);
}

 if (!config('app.debug')) {
 return parent::render($request, $e);
}

 return response()->view('errors', ['error' => $e->getMessage()], 500);
 }

If ajax requests are all more or less standards - are caught in error the error text, then display the "vsplyvala" (although it still sucks to repeat the same thing in every ajax method and I think it is possible somehow to make nicer)
)
 .error(function(data) {
 $.notify(data.message, "error");
});

, the errors when loading pages is not so smooth. Tried using flash messages, adding to the basic pattern block with errors of this kind:
@section('flash')
@if(Session::has('flash_success'))
 <div class="alertFlash alert alert-success">{!! session('flash_success') !!}</div>
@endif
@if(Session::has('flash_warning'))
 <div class="alertFlash alert alert-warning">{!! session('flash_warning') !!}</div>
@endif
@if(Session::has('flash_error'))
 <div class="alertFlash alert alert-danger">{!! session('flash_error') !!}</div>
@endif
 @show

but as for me somehow neoch this option and would like to have all errors were of the same type, for example using vsplyvaet to js via a call to $notify.
I would like kakogoto universal solution, or even quite elegant....
2. The entire business logic I am presenting in the repository, and the actual errors I immediately probressive Exception in the spirit:
abort(500, 'error Text);
In my current implementation, of course, this leads to the introduction on page 500 and the terminal error text is requested... what if the error is not critical, but would still display it and open the page even with errors that will not be seen in production.

Actually I got confused in the desire to beautifully organize the output of the error and norm of examples in the projects on github\articles couldn't find. I will be glad to see any suggestions, links to articles\turnips. Thank you!
July 8th 19 at 12:00
1 answer
July 8th 19 at 12:02
I need all the info thrown into the log (by category). View log brought to the admin panel, browsing through this Pribluda:
5 Laravel log viewer
The log is great, especially on categories. But how best to organize the output errors directly to the user?) The question is this =) - vesta80 commented on July 8th 19 at 12:05

Find more questions by tags Laravel