copy errors directory from resource views
-inside error directory create page 403.blade,202.blade ... same as the name inside the switch case of render function of handler.
and
copy errormaster from layouts of resource
copy and paste code inside handler of exception folder in render function
paste the following code:
always change APP_debug of env file from true to false#important
default maa j xa tyo lai change app_debug thats all
NEXT WAY:-
Simply go inside: vendor/laravel/src/illuminate/foundation/exceptions/views/404.blade.php
Sorry :) laravel 5.7 have provided this autometically ... but from here you can change message... by changing on the @section('message'_('custom message here'))
now its done hai ta
Best way of error handling in laravel 6 :
in illustrated-layout.blade of error folder :
<a href="{{ app('router')->has('home') ? route('home') : url('/') }}">
to
now on each error page :
change the following:
-inside error directory create page 403.blade,202.blade ... same as the name inside the switch case of render function of handler.
and
copy errormaster from layouts of resource
copy and paste code inside handler of exception folder in render function
paste the following code:
public function render($request, Exception $exception)
{
if ($this->isHttpException($exception)) {
$message = $exception->getMessage();
// dd($message);
switch ($exception->getStatusCode()) {
// not authorized
case '403':
return \Response::view('errors.403',array(compact('message')),403);
break;
case '202':
return \Response::view('errors.202',array(compact('message')),202);
break;
// not found
case '404':
return \Response::view('errors.404',array(compact('message')),404);
break;
// internal error
case '500':
return \Response::view('backend.errors.500',array(compact('message')),500);
break;
default:
return $this->renderHttpException($exception);
break;
}
} else {
return parent::render($request, $exception);
}
return parent::render($request, $exception);
}
always change APP_debug of env file from true to false#important
default maa j xa tyo lai change app_debug thats all
NEXT WAY:-
Simply go inside: vendor/laravel/src/illuminate/foundation/exceptions/views/404.blade.php
@extends('errors::illustrated-layout')
@section('code', '404')
@section('title', __('Page Not Found'))
@section('image')
<div style="background-image: url('/svg/404.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Sorry, the page you are looking for could not be found.'))
Sorry :) laravel 5.7 have provided this autometically ... but from here you can change message... by changing on the @section('message'_('custom message here'))
now its done hai ta
Best way of error handling in laravel 6 :
php artisan vendor:publish --tag=laravel-errors
then you will need to do following things:in illustrated-layout.blade of error folder :
<a href="{{ app('router')->has('home') ? route('home') : url('/') }}">
<button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
{{ __('Go Home') }}
</button>
</a>
to
<a href="{{ app('router')->has('front.index') ? route('front.index') : url('/') }}">
<button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
{{ __('Go Home') }}
</button>
</a>
now on each error page :
change the following:
@extends('errors::minimal')
to
@extends('errors::illustrated-layout')
Comments
Post a Comment