raphael
11 months ago
172
3
Laravel

Custom Error Page (not Custom HTTP Error Page)

Posted 11 months ago by raphael

[Laravel 5.5]

I would like to show a custom error page that has the same look as Laravel's HTTP errors (404, 500 etc.).

Controller:

$user = User::whereChangeEmailToken($token)->first();
if (! $user) {
    return view('errors.token');
}

Blade Template:

@extends('errors::layout')
@section('title', 'Unknown Token')
@section('message')
    Unknown Token
    <br>
    <br>
    <small>This link is invalid because we do not know this token.</small>
@stop

As you see, the blade template extends the errors layout in the same way as the http errors.

However, it gives me this error:

No hint path defined for [errors]. (View: /home/vagrant/code/project/resources/views/errors/token.blade.php)

My custom HTTP error pages in the same directory do work, though.

What am I doing wrong?

Please sign in or create an account to participate in this conversation.