Skip to main content

Laravel 8 Custom Error Page Tutorial

how to create custom error page in laravel?

Hi Dev,

Today,I will learn you how engender Custom Error Page in laravel 8. we will show example of laravel 8 custom error page example . you will learn how to engender custom error page in laravel 8. you will learn how to engender 404 error page in laravel 8. we will avail you to give example of how to set 404 error page in laravel 8. if you optate to optically discern example of laravel 8 custom 404 page then you are a right place. Let's get commenced with laravel 8 incipient error page example.

You require to engender blade file like 404.blade.php, 405.blade.php etc on errors(resources/view.errors) directory in laravel 8. you can optically discern i engendered 404 blade file and check it on your project.

Virtually we are utilizing theme for front-end or backend side and we always probing for set 404, 500 or 505 error page design from there that we utilized for project. So it is a very simple and facile way to engender custom 404 page in laravel 8 project. i integrated below screen shot of laravel 8 error page design.

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

So, you just need to engender 404 blade file and put your own code like i integrated 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 - Itwebtuts.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/okgays

Now you can simply check it out.

Output

I will help you...

Comments

Popular posts from this blog

Laravel Scout Algolia Full Text Search Example

Hi Guys Today,I will tell how you can full text search utilizing scout algolia. i will show the example of laravel scout algolia full text search.you can full text search utilizing scout algolia api.it can this example full expound scout algolia full text search. I will show the rudimental step of scout algolia api full text search.if you can utilize full text search for install scout and Algolia api package.we are utilizing algolia api utilizing full text search example in laravel. Here the following steps example laravel full text search Using scout algolia Step 1: Create Laravel Project In this step create laravel project following command. composer create-project --prefer-dist laravel/blog Step 2: Database Configuration After create laravel project , we require to make database configuration, you have to add following details on your .env file. 1.Database Username 1.Database Password 1.Database Name In .env file also available host and port details, you can configu

Laravel IP Address Using Get Location Example

Hi Dev, Today,I will learn you how to get location useing ip address in laravel. we will show example of laravel ip address using get location. you can easy to get location useing ip address in laravel.In this example, I will useing stevebauman/location packege get location useing ip address in laravel. Many time you will need to get visitor's details for security, spam prevention etc. It's very easy to get visitor ip address and their location in PHP Laravel. Step 1: Install stevebauman/location Now, We will install stevebauman/location package using below command.Require this package with composer. It is recommended to only require the package for development. composer require stevebauman/location Step 2: Add providers and aliases In this step,We will add below providers and aliases in the "config/app.php" file. config/app.php 'providers' => [ .... Stevebauman\Location\LocationServiceProvider::class, ], 'aliases' => [ .... 'Loca

Laravel 6 validation required if another field is empty

Hii guys, In this artical, i will give you example of laravel 6 in validation required if another field is empty. We know laravel provide several in-built laravel 6 validation required_without . If you need to add validation rules like required if other field is empty in laravel then you can do it using required_without. I am going to explain you, If you can not enter test (field) value at that time test1 (field) is required. So at that time you can add validation required_without. So, you can use this way: "test1" =>"required_without:test" Example: public function store(Request $request) { $request->validate([ "test" =>"required", "test1" =>"required_without:test" ]); dd("Done!"); } If return validation error otherwise show Done!. It will help you...