“Kustom 404 Halaman di Laravel” Kode Jawaban

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');
Shadow

404 Halaman di 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);
    }
Mohamad

Kustom 404 Halaman di Laravel

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

Kesalahan Laravel 404 di server

$ sudo a2enmod rewrite
$ sudo service apache2 restart
Grumpy Guanaco

Jawaban yang mirip dengan “Kustom 404 Halaman di Laravel”

Pertanyaan yang mirip dengan “Kustom 404 Halaman di Laravel”

Lebih banyak jawaban terkait untuk “Kustom 404 Halaman di Laravel” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya