andybeak
7/20/2016 - 2:01 PM

Laravel custom errors

Laravel custom errors

<!DOCTYPE html>
<html>
    <head>
        <title>An error occurred</title>

        <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet" type="text/css">
        <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <link href='https://fonts.googleapis.com/css?family=Hind' rel='stylesheet' type='text/css'>

        <style>
        body {
            font-family: 'Hind', sans-serif;
        }
        .error {
            margin: 0 auto;
            text-align: center;
        }

        .error-code {
            bottom: 60%;
            color: #2d353c;
            font-size: 96px;
            line-height: 100px;
        }

        .error-desc {
            font-size: 12px;
            color: #647788;
        }

        .m-b-10 {
            margin-bottom: 10px!important;
        }

        .m-b-20 {
            margin-bottom: 20px!important;
        }

        .m-t-20 {
            margin-top: 20px!important;
        }
        img {
            width: 400px;
            margin-top: 40px;
        }
        a {
            margin-top:40px;
        }
        </style>
    </head>
    <body>
        <div class="error">
        <div class="error-code m-b-10 m-t-20">@yield('code')</div>
        <h3 class="font-bold">@yield('shortmessage')</h3>
        <div class="error-desc">
            @yield('longmessage')
            <div>
                <a class="btn btn-info" href="/">
                        <i class="fa fa-arrow-left"></i>
                        Go back to Homepage
                    </a>
            </div>
        </div>
        <img src="https://http.cat/@yield('code').jpg">
    </div>
    </body>
</html>
@extends('layouts.error')

@section('code')
    502
@endsection
@section('shortmessage')
    Bad Gateway&hellip;
@endsection
@section('longmessage')
    The server, while acting as a gateway or proxy, received an invalid <br>
    response from an inbound server it accessed while attempting to <br>
    fulfill the request.
@endsection
@extends('layouts.error')

@section('code')
    500
@endsection
@section('shortmessage')
    Internal Server Error&hellip;
@endsection
@section('longmessage')
    The server encountered an unexpected condition that <br>
    prevented it from fulfilling the request.
@endsection
@extends('layouts.error')

@section('code')
    404
@endsection
@section('shortmessage')
    We couldn't find the page&hellip;
@endsection
@section('longmessage')
    Sorry, but the page you are looking for was either not found or does not exist.<br>
    Try refreshing the page or click the button below to go back to the Homepage.
@endsection
@extends('layouts.error')

@section('code')
    403
@endsection
@section('shortmessage')
    Forbidden&hellip;
@endsection
@section('longmessage')
    If authentication credentials were provided in the request, the server <br>
    considers them insufficient to grant access. The client SHOULD NOT <br>
    automatically repeat the request with the same credentials. <br>
    The client MAY repeat the request with new or different credentials. <br>
    However, a request might be forbidden for reasons unrelated to the <br>
    credentials.
@endsection