Avoid error screens by address bar manipulation

0

I would like to know how to avoid an error of the type  NotFoundHttpException in RouteCollection.php line 161 (or any other error that informs the user of what happens in laravel) when entering manually or trying to manipulate the address bar by placing some text or path that does not exist. I know that you can put the debug to false hidden this information, but the screen would come with the "Opps", which should also not appear when entering something that does not exist in the address bar. I know there are several methods to achieve this but I would like to know which is the most used and the most effective.

In case someone has come here and does not understand what I mean, I'll give a more representative example.

We have this route

link

and someone has to modify it and put something like that

link

in this case the screen with the Opps would appear if the debug is false or with the NotFoundHttpException if the debug is true, what I want to know is the best system to prevent these screens from being displayed.

    
asked by KurodoAkabane 18.01.2017 в 19:33
source

1 answer

0

In the case of laravel, it handles error pages, located in the folder resources- > views- & errors; What you should do is create a new page depending on your status code

for example the 405 code, which refers to the route not found, there you create the file called 405.blade.php .

This is an example code

405.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>Ruta no encontrada.</title>

    <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

    <style>
        html, body {
            height: 100%;
        }

        body {
            margin: 0;
            padding: 0;
            width: 100%;
            color: #B0BEC5;
            display: table;
            font-weight: 100;
            font-family: 'Lato';
        }

        .container {
            text-align: center;
            display: table-cell;
            vertical-align: middle;
        }

        .content {
            text-align: center;
            display: inline-block;
        }

        .title {
            font-size: 72px;
            margin-bottom: 40px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="content">
        <div class="title">Error 405. Ruta No Encontrada</div>
    </div>
</div>
</body>
</html>

    
answered by 18.01.2017 в 21:32