// Create a file in resources/views/errors/404.blade.php and add this code.
@extends('errors::minimal')
@section('title', __('Not Found'))
@section('code', '404')
@if($exception)
@section('message', $exception->getMessage())
@else
@section('message', __('Not Found'))
@endif
abort(404, 'Whatever you were looking for, look somewhere else');
//Some exceptions describe HTTP error codes from the server. For example, this may be a "page not found" error (404),
//In order to generate such a response from anywhere in your application, you may use the abort helper:
return abort(404);
// OR
return abort(404, "page not found");
//step 1 ) create the errors/404.blade.php in view.
// step 2 ) go to Handler.php and replace the render function to belwo function.
public function render($request, Throwable $exception)
{
if ($exception instanceof AccessDeniedHttpException) {
return response(view('errors.404'), 404);
}
return parent::render($request, $exception);
}
A very simple one
php artisan vendor:publish --tag=laravel-errors
//Access error code in view
@if(isset($exception) && $exception->getStatusCode() == 404)
@endif
abort(404)
$ sudo a2enmod rewrite
$ sudo service apache2 restart
//first check your route is there in route:list, if it it here
//then Some times it occurs because of url mismatch
//url in laravel is case senstive so make sure your whole url is correct.
Code Example |
---|
Php :: use latest with first in laravel eloquent |
Php :: laravel 8 – remove public from url |
Php :: eloquent whereraw |
Php :: flutter network image svg |
Php :: hmtl remove tag php |
Php :: symfony redirect to previous page |
Php :: iteration in php |
Php :: laravel insert timestamp now |
Php :: php time ago |
Php :: php float round |
Php :: php fpm config file location |
Php :: wordpress get current taxonomy |
Php :: random 6 digit number php |
Php :: 18 year back date in php |
Php :: getMessage in php |
Php :: substract 2 dates php |
Php :: laravel get timezone from ip address |
Php :: laravel redirect with message to section |
Php :: laravel foreach loop |
Php :: how to set date in php |
Php :: get month from database php |
Php :: PHP not working centos 8 |
Php :: Carbon fomart date |
Php :: curl in laravel |
Php :: php end session |
Php :: laravel duplicate row |
Php :: get featured image id wordpress |
Php :: laravel store method |
Php :: laravel forcefill |
Php :: default timezone php |