Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel custom 404 blade

// 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');
Comment

laravel 404

//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");
Comment

404 page in laravel

//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);
    }
Comment

custom 404 page in laravel

A very simple one
  
  php artisan vendor:publish --tag=laravel-errors
Comment

PREVIOUS NEXT
Code Example
Php :: how to add script in WordPress admin page 
Php :: php 8 attributes 
Php :: php select from database into array 
Php :: eloquent model sort by ascending order 
Php :: php random name 
Php :: php artisan vendor:publish 
Php :: password required wp 
Php :: a facade root has not been set laravel 
Php :: how to show validation error in laravel 8 
Php :: wordpress is admin 
Php :: laravel route view 
Php :: convert date php 
Php :: wordpress truncate text 
Php :: max. post size 
Php :: osx php 
Php :: laravel migration two primary key 
Php :: laravel with where has 
Php :: laravel vue build production 
Php :: pdo connect 
Php :: Laravel Validation error message in blade or view 
Php :: refresh a specific migration laravel 
Php :: larave artisan command run in web 
Php :: php add 1 day to current date 
Php :: ubuntu install php 8 mysql 
Php :: php capitalize first letter 
Php :: get url link in php 
Php :: how validate array in laravel in request 
Php :: hmtl remove tag php 
Php :: laravel foreign key constraint 
Php :: laravel menu active class 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =