Laravel 8 Create Custom Error Page

By : phpicoder Created : February 22, 2021

Hello guys, In this tutorial, we will learn how to create custom error page in laravel 8 web applications. We will learn how to create a custom error page in Leravel 8. This article will give you a simple example of how to create a 404 error page in Laravel 8. In this article, we will implement a how to set 404 error page in laravel 8.

404 Page View

laravel 8 custom error page

If an error occurs in Laravel, a default default page is displayed. But if you want to create your own custom error page if yes you are in the right place

Create View file

Now go to resources/views/ folder and then create new folder name errors and then go to errors folder and need to create blade file like as bellow 

  • 404.blade.php
  • 405.blade.php

 Edit 404.blade.php

open 404.blade.php file and edit below code

<!DOCTYPE html>
<html>
<head>
	<title>Custom Error Page - phpicoder.com</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
</head>
<body>
  <div class="container">
    <div class="row text-center">
      <div class="col-md-6 offset-md-3 error-div">    
          <br><br><br><br><br><br>
          <div class="jumbotron">
            <h1>404</h1>
            <h6>Page not found - PHPICoder.com</h6>
          </div>
      </div>
    </div>
  </div>
</body>
</html>

Run Laravel App

Start the laravel application with following command: 

php artisan serve

After run above command you click this  https://127.0.0.1:8000/xsds url

I hope it can help you for ustom error page in laravel 8 tutorial.....