Laravel 8 Custom Error Page Example Tutorial

Laravel 6 , Laravel , Laravel 7 , Laravel 8

Nicesnippets

659

30-09-2020


Laravel 8 Custom Error Page Example Tutorial

Hi Guys,

Today,I will learn you how create Custom Error Page in laravel 8. we will show example of laravel 8 custom error page example . you will learn how to create custom error page in laravel 8. you will learn how to create 404 error page in laravel 8. we will help you to give example of how to set 404 error page in laravel 8. if you want to see example of laravel 8 custom 404 page then you are a right place. Let's get started with laravel 8 new error page example.

You need to create blade file like 404.blade.php, 405.blade.php etc on errors(resources/view.errors) directory in laravel 8. you can see i created 404 blade file and check it on your project.

Almost we are using theme for front-end or backend side and we always looking for set 404, 500 or 505 error page design from there that we used for project. So it is a very simple and easy way to create custom 404 page in laravel 8 project. i added below screen shot of laravel 8 error page design.

Now you have to just create "errors" folder in your resources directory and then after you need to create 404.blade.file inside that folder. So, basically laravel 8 will stetted default design, but if you created 404 file into "errors" directory then it will take from there.

So, you just need to create 404 blade file and put your own code like i added then you can simply check it out.

resources/views/errors/404.blade.php


<!DOCTYPE html>

<html>

<head>

<title>Custom Error Page</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" ></script>

<style type="text/css">

.error-div{

margin-top: 200px;

background: #c1c1c1;

padding: 70px;

border-radius: 5px;

}

.error-div h1{

font-size: 50px;

font-weight: bold;

}

.error-div h6{

font-family: ubuntu;

font-size: 20px;

}

</style>

</head>

<body>

<div class="container">

<div class="row text-center">

<div class="col-md-6 offset-md-3 error-div">

<h1>404</h1>

<h6>Page not found - Nicesnippets.com</h6>

</div>

</div>

</div>

</body>

</html>

After you can simply run your application by following command:

php artisan serve

Now you can open following url and you will see error page as above:

http://localhost:8000/asas

Now you can simply check it out.

I will help you...


Recommended Posts